Solved

Passing multiple custom variables to PayPal and back

Posted on 2011-03-10
7
999 Views
Last Modified: 2012-06-21
Hi,
    I have a PayPal IPN configured which is working fine.  However I am already using the custom variable, but need to pass another variable.

How can I achieve the passing of a second variable through the IPN?

Cheers

Damian
0
Comment
Question by:damianb123
  • 4
  • 3
7 Comments
 
LVL 16

Expert Comment

by:sjklein42
Comment Utility
There is only one "custom" variable passed through the IPN messages.

Paypal expects us to construct a "custom" value packed with everything we need for closure, and then take it apart again on the "other side".

I don't see any way to add another variable to the IPN call without using "custom".
0
 

Author Comment

by:damianb123
Comment Utility
Well currently I pass a user I'd, but I also want to pass an encrypted password! Is there another preset field I could use for password, or how would I stuff the lot into the custom variable???
0
 
LVL 16

Expert Comment

by:sjklein42
Comment Utility
You get to use up to 255 characters in the custom variable.

It is pretty much up to you how you want to pack your data.  I would probably use the pipe | character to separate the fields.  So just pack together the username and password with a | character between them.

On the other side (in your Paypal IPN script) you need to split the custom variable back apart again on the | character.  Whatever language you are using it will have some string split function.
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:damianb123
Comment Utility
I am using php, so how could I,

A) pack it into the variable at my form submission end, and b)
Unpack at the other end?

Any ideas?
0
 
LVL 16

Accepted Solution

by:
sjklein42 earned 500 total points
Comment Utility
Use the concatenation operator which is the '.' (dot) and the explode function:

To pack:

$packedCustom = $userID . "|" . $encryptedPassword;

Open in new window

To unpack:
list($userID, $encryptedPassword) = explode("|", $packedCustom);
echo $userID;
echo $encrypedPassword;

Open in new window

0
 

Author Comment

by:damianb123
Comment Utility
That's superb, I will try in the morning and let you know, thanks.....
0
 

Author Closing Comment

by:damianb123
Comment Utility
This worked great, thanks very much.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now