开发者

Passing a variable from beginning to end - Paypal

I'be been at this for days and i cant seem to figure it out. All i want to do is when subscribe button is pushed, a variable is send ( post get i dont care ) payment is completed and landed on the success page, with my variable!

From what i can gather this should be able to do it:

<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="0000000">
<Input type="hidden" name="custom" value="<?php md5($code.microtime()); ?>"/>
<input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_subscribeCC_L开发者_如何学PythonG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

Any help much appreciated ( and yes I've read paypal and sandbox documentation, just not that good at reading. )


The variables 'custom' and 'invoice' are both what PayPal calls "pass-through" variables. PayPal doesn't do anything with them, it just passes them back to you in any IPN notifications that you receive regarding that transaction (someone makes a payment, a chargeback, etc).

I can confirm personally that this works correctly as of right now using the 'custom' variable. I am using their Standard (free) payment solution currently...

How are you monitoring the IPN notification to see what variables are being posted back to you?

Edit - Additional Info Added Below:

I wanted to expand on this a bit as I was very recently caught by an issue related to pass-through variables!

The 'invoice' variable must be UNIQUE per transaction; PayPal will only allow 1 completed payment to come through per UNIQUE invoice string. Any subsequent attempts to checkout (that come in with an already-paid 'invoice' variable) will immediately be shown a "This invoice was already paid for." message.

The 'custom' variable on the other hand is NOT required to be unique and is intended to strictly be used as a pass-through variable - in most cases this is what you want to use when you're just looking for the 'pass-through' functionality.

Hope that helps - the uniqueness issue recently cost me nearly a full day of a broken checkout process on a personal project of mine!


Missing an echo. Instead of this:

<?php md5($code.microtime()); ?>

Try this:

<?php echo md5($code.microtime()); ?>


PayPal will not process your custom data, so instead of sending it to them and getting it back, just store it in your own database. Associate the data with the transaction using invoice as the key.

In your landing page, you can get the invoice from PayPal transaction. Then you can fetch the data from your own database that referred by that invoice id.


The issue seems to be no seems to get CUSTOM being passed through in Sandbox

Shame PayPal is not that good as we all thought


Try this:

<input type="hidden" name="custom" value=<?php echo "\"".md5($code.microtime())."\""; ?>/>

There was a missing echo and also the quotes are around the value, not the php

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜