Solved

Passing multiple custom variables to PayPal and back

Posted on 2011-03-10
7
1,013 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Are you using email marketing software? If not, you're missing out on effortless marketing and the reaching of desired conversion rates through email marketing software.
The viewer will learn how to dynamically set the form action using jQuery.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

919 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

14 Experts available now in Live!

Get 1:1 Help Now