Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Passing multiple custom variables to PayPal and back

Posted on 2011-03-10
7
Medium Priority
?
1,245 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
ID: 35097992
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
ID: 35098515
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
ID: 35098831
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:damianb123
ID: 35098989
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 2000 total points
ID: 35099140
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
ID: 35099551
That's superb, I will try in the morning and let you know, thanks.....
0
 

Author Closing Comment

by:damianb123
ID: 35165518
This worked great, thanks very much.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How important is it to take extra precautions to protect your online business? These are some steps you can take to make sure you're free of any cyber crime.
The Internet has made sending and receiving information online a breeze. But there is also the threat of unauthorized viewing, data tampering, and phoney messages. Surprisingly, a lot of business owners do not fully understand how to use security t…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

972 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