Solved

Passing multiple custom variables to PayPal and back

Posted on 2011-03-10
7
1,030 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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Often people are aiming at development of perfect Magento websites. Though, it is easier said than done. You know what’s much easier? To ruin everything. It can be done in seconds. Many of us experimented with design, tried to change some values dir…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
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.

776 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