开发者

How to get value back from Paypal?

开发者 https://www.devze.com 2023-01-23 17:18 出处:网络
I am facing this problem from last month. First i was able to get value back from paypal. Now I am not able to get back value from paypal.

I am facing this problem from last month. First i was able to get value back from paypal.

Now I am not able to get back value from paypal.

I am using following code.

<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" style="padding: 0; margin: 0;">
    <input type="hidden" name="cmd" value="_xclick/" />
    <input type="hidden" name="business" value="my_bussiness_id" />
    <input type="hidden" name="quantity" value="1" />
    <input type="hidden" name="item_name" value="item" />
    <input type="hidden" name="item_number" value="1" />
    <input type="hidden" name="amount" value="item_price" />
    <input type="hidden" name="shipping" value="0" />
    <input type="hidden" name="no_note" value="1" />
    <input type="hidden" name="notify_url" value="Your_notify_url">
    <input type="hidden" name="currency_code"开发者_如何学编程 value="GBP" />
    <input type="hidden" name="rm" value="2" >
    <input type="hidden" name="return" value="your return url">
    <input type="image" border="0" name="paypal" src="images/btn_paypal_nl.gif" onClick="" />
    </form>

Thanks in advance..

Kanji


There's actually two methods of getting the data back--a return URL that posts upon completion with return values (I've not been terribly lucky making that work) then a separate function that sends you a post upon completion of a transaction to a separate page on your site, where you can collect back all the variables you posted to the site. I suggest the latter because on a buy it now page there's a possibility of the user not being returned to the site because the return button UI is pretty weak on PayPal's end.

To set it up you'd log in to your PayPal account, click on myaccount > profile > website payment preferences. Enabling the "payment data transfer" will do the trick. Once you've got it setup correctly, upon completion of a transaction it'll send to the page of your choice a post of everything you sent it....remember, you can send in variables such as Name, Address, etc just by defining them properly in the form. All the variables available are found here

Don't forget to build a sandbox site to test! Good Luck.


What I have normally done is this: You see where you got notify_url as a hidden tag, use that for paypal to send you information about the transaction. The url you put down should be a file on your server that will then do some logic, i.e. update your database that everything was ok, send out notification email of order, etc, etc

When paypal talks to this page, altho cant see the process, everything is sent via $_POST. What I do as a test is i loop thru the $_POST array and send myself an email so I know what values have been posted back to me.

//paypal variables
$message = "<h1>Paypal variables</h1>";
foreach($_POST as $key => $value)
{
    $message.= $key . " - " . $value . "<br />";
}

Link below gives you more info. https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_admin_IPNIntro

0

精彩评论

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

关注公众号