How to get value back from Paypal?

有些话、适合烂在心里 提交于 2019-12-04 14:57:14

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!