通知 PayPal 的 URL

发布于 2024-09-02 10:43:10 字数 160 浏览 2 评论 0原文

PayPal 成功返回我在创建“立即购买”按钮时指定的返回 URL。但现在我很困惑。 如何检索有关 PayPal 上发生的交易的详细信息?我还想在返回 URL 上设置一些数据库值。但我担心如果我的用户没有付费就导航到该 URL,他仍然会成为高级会员。我该如何避免这种情况?

PayPal successfully returns me 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 took place on PayPal? I also want to set some database values on the return URL. But I am afraid if my user navigates to that URL without paying, he will become a premium member nonetheless. How do I avoid this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

守不住的情 2024-09-09 10:43:10

PayPal 通过他们所谓的 IPN 将数据返回到您的网站。它实际上只是对您指定的 URL 的回调。
您可以通过发送至 PayPal 的变量 notify_url 设置此 URL。

示例:

<input name="notify_url" value="http://yourdomain.com/notify_url.php" type="hidden">

上例中的notify_url.php 在付款完成后从PayPal 接收一些POST 变量,即使客户从未返回您的网站。

返回了一些重要的变量 PayPal 的格式为:

  • mc_gross
  • 发票结算
  • _金额
  • 保护_
  • 资格地址_状态
  • 付款人_id
  • 税务
  • 地址_街道
  • 付款_
  • 日期付款_状态
  • 字符集
  • 地址_zip
  • mc_shipping
  • mc_处理
  • first_name
  • mc_fee
  • 地址_
  • 国家/地区代码交换率
  • 地址_
  • 名称通知_版本
  • 结算_货币
  • 自定义
  • 付款者_
  • 状态业务
  • 地址_国家/
  • 地区地址_城市
  • 验证_
  • 签名付款者_电子邮件
  • txn_id
  • 付款_类型

如果设置,则返回 发票。它可以用作您自己的订单 ID/交易 ID。

txn_id 由 PayPal 生成,是他们自己的交易 ID。

如果您自己添加商品,PayPal 还会返回 num_cart_items、item_name1(item_name2、item_name3)、quantity1(quantity2、quantity3)等。

更多阅读请访问 https://cms.paypal .com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_Appx_websitestandard_htmlvariables

当然,您仍然有问题需要解决,如何检查所有这些数据并将其连接到您的客户您可能拥有自己的数据库。

我所做的是在将客户发送到 PayPal 之前保存临时“订单”,并提供发票 ID,该 ID 与我发送到 PayPal 作为发票的 ID 相同。这样我的notify_url.php页面可以检查我的数据库中的发票ID并比较订单/付款。

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.

Example:

<input name="notify_url" value="http://yourdomain.com/notify_url.php" type="hidden">

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.

Some of the important variables returned by PayPal is:

  • 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

invoice is returned if you set it. It can be used as your own order-id/transaction-id.

txn_id is generated by PayPal and it is their own id for the transaction.

If you add items yourself you will PayPal also returns num_cart_items, item_name1 (item_name2, item_name3), quantity1 (quantity2, quantity3) and such.

More reading at https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_Appx_websitestandard_htmlvariables

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.

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文