Passing multiple custom variables to PayPal and back

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
damianb123Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
sjklein42Connect With a Mentor Commented:
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
 
sjklein42Commented:
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
 
damianb123Author Commented:
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
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
sjklein42Commented:
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
 
damianb123Author Commented:
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
 
damianb123Author Commented:
That's superb, I will try in the morning and let you know, thanks.....
0
 
damianb123Author Commented:
This worked great, thanks very much.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.