PayPal订阅按钮并存储到DB流

发布于 2025-02-12 05:34:09 字数 223 浏览 1 评论 0原文

我正在尝试以节点中的PayPal订阅流量为单位,现在所有的所有SDK似乎都被弃用了,我正在努力寻找实现订阅按钮的当前示例,然后验证订阅并在本地更新用户的状态DB。

我认为2022年的预期流量是实现标准按钮,并使用网络钩聆听该事件,此时您会验证有效负载,并更新本地DB以反映新的订阅状态。

我想这意味着在按钮的Onapprove客户端方法中,我们可以对本地数据库进行某种民意调查,以检查订阅状态是否已更改?

I'm attempting a Paypal subscription flow in Node, bug all of the various SDKs seem to be deprecated now, and I'm struggling to find a current example of implementing a subscription button and then validating the subscription and updating the user's status in local db.

I think the expected flow in 2022 is to implement a standard button and use a webhook to listen out for the event, at which point you verify the payload, and update a local DB to reflect the new subscription status.

I guess this means that in the OnApprove clientside method of the button, we could run some sort of polling against the local DB to check that the subscription status has changed?

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

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

发布评论

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

评论(1

瀟灑尐姊 2025-02-19 05:34:09

Onapprove回调已经接收到表明订阅已批准的数据。这足以满足客户端的结果(不适用于数据库操作,因为它是客户端)。

要将结果存储在数据库中,请收听webhook付款。sale.com。此Webhook将触发首次付款以及订阅中的每笔付款。这是您唯一需要关注的Webhook,所有订阅逻辑都可以完全由付款驱动。

为了帮助对帐,在创建订阅时添加custom_id参数。其值将在订阅的Webhooks事件中返回。

The onApprove callback already receives data indicating the subscription has been approved. This is sufficient for client-side presentment of the result (not to be used for database operations, as it is client-side).

For storing the result in a database, listen for the webhook PAYMENT.SALE.COMPLETED. This webhook will trigger for the first payment, as well as every future payment on the subscription. It is the only webhook you need to be concerned about, all subscription logic can be driven solely by PAYMENT.SALE.COMPLETED.

To aid in reconciliation, add a custom_id parameter when creating the subscription. Its value will be returned in webhooks events for the subscription.

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