通知Paypal网址 [英] Notify url of Paypal
问题描述
Paypal成功地将我返回到我在创建立即购买"按钮时指定的返回网址.但是,现在我很困惑. 如何检索有关Paypal上发生的交易的详细信息?,我还想在返回URL上设置一些数据库值.但是,如果我的用户不付钱给Paypal,我担心他也将成为高级会员.我该如何确保呢?
Paypal returns me successfully to the return url that i specify while creating buy now button. But, now I am confused. How do I retrieve details about the transaction that happened on Paypal? And I also want to set some database values on the return url. But I am afraid if my user without paying to paypal goes to that url, then he too will become premium member. How do I secure this?
推荐答案
PayPal通过他们所谓的IPN将数据返回到您的站点.它实际上只是对您指定的URL的回调. 您可以通过发送到PayPal的变量 notify_url 设置此URL.
PayPal returns data back to your site via what they call IPN. Its really just a callback to a URL you specify. You can set this URL via the variable notify_url you can send to PayPal.
示例:
<input name="notify_url" value="http://yourdomain.com/notify_url.php" type="hidden">
以上示例中的notify_url.php在付款完成后会从PayPal接收一些POST变量,即使客户从不返回您的网站也是如此.
The notify_url.php in the example above receives some POST variables from PayPal when the payment is completed, even if the customer never returns to your website.
一些重要的变量 PayPal返回的是:
Some of the important variables returned by PayPal is:
- mc_gross
- 发票
- settle_amount
- protection_eligibility
- address_status
- payer_id
- 税
- address_street
- 付款日期
- payment_status
- 字符集
- address_zip
- mc_shipping
- mc_handling
- 名字
- mc_fee
- 地址国家/地区代码
- exchange_rate
- 地址名称
- notify_version
- settle_currency
- 自定义
- payer_status
- 业务
- address_country
- address_city
- verify_sign
- payer_email
- txn_id
- payment_type
- mc_gross
- invoice
- settle_amount
- protection_eligibility
- address_status
- payer_id
- tax
- address_street
- payment_date
- payment_status
- charset
- address_zip
- mc_shipping
- mc_handling
- first_name
- mc_fee
- address_country_code
- exchange_rate
- address_name
- notify_version
- settle_currency
- custom
- payer_status
- business
- address_country
- address_city
- verify_sign
- payer_email
- txn_id
- payment_type
发票,则将其退回.可以用作您自己的订单ID/交易ID.
invoice is returned if you set it. It can be used as your own order-id/transaction-id.
txn_id由PayPal生成,是他们自己的交易ID.
txn_id is generated by PayPal and it is their own id for the transaction.
如果您自己添加商品,PayPal还将返回num_cart_items,item_name1(商品名称2,item_name3),quantity1(quantity2,quantity3)等.
If you add items yourself you will PayPal also returns num_cart_items, item_name1 (item_name2, item_name3), quantity1 (quantity2, quantity3) and such.
当然,您仍然要解决问题,如何检查所有这些数据并将其连接到您自己可能拥有的数据库中的客户.
Of course then you still have the problem to solve, how to check all this data and connect it to a customer in your own database, which you probably have.
我要做的是保存临时的订单",然后再将客户发送给带有发票ID的PayPal,该ID与我发送给PayPal的发票ID相同.这样,我的notify_url.php页可以检查我的数据库中的发票ID并比较订单/付款.
What I do is to save a temporary "order" before I send the customer to PayPal with a invoice id, same id i send to PayPal as invoice. This way my notify_url.php page can check my database for a invoice id and compare the order/payment.
这篇关于通知Paypal网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!