简体   繁体   English

发出 paypal 订阅 API 请求以获取服务器上的订阅信息 - 身份验证包装器?

[英]Make paypal subscriptions API request to get subscription info on server - auth wrapper?

I'd like to get a subscription information from the subscription API endpoint我想从订阅 API 端点获取订阅信息

/v1/billing/subscriptions https://developer.paypal.com/docs/api/subscriptions/v1/#subscriptions /v1/billing/subscriptions https://developer.paypal.com/docs/api/subscriptions/v1/#subscriptions

It requires an auth bearer token, and I don't want to spend weeks setting up an auth handler.它需要一个身份验证持有者令牌,我不想花费数周时间设置身份验证处理程序。 Paypal's current repos doesn't support subscriptions endpoint (or most others TBH...): checkout SDK and payouts SDK Paypal 的当前回购不支持订阅端点(或大多数其他 TBH...):结帐 SDK支出 SDK

These probably have some auth wrapper but I'm struggling to determine how to use it to make fetch() calls from my server to the subscriptions endpoint, does anyone have a solution they've used?这些可能有一些身份验证包装器,但我正在努力确定如何使用它来从我的服务器到订阅端点进行fetch()调用,有人有他们使用过的解决方案吗?

FYI: I'm using paypal smart buttons to create a subscription and then making an api call with subscription id to add details to user in DB仅供参考:我正在使用 paypal 智能按钮创建订阅,然后使用订阅 ID 进行 api 调用以向数据库中的用户添加详细信息

I'm struggling to determine how to use it to make fetch() calls to the subscriptions endpoint, does anyone have a solution they've used?我正在努力确定如何使用它来对订阅端点进行 fetch() 调用,有没有人有他们使用过的解决方案?

Don't do that.不要那样做。 Fetch calls should go to your server. Fetch 调用应该 go 到您的服务器。 Only your server should ever call subscription endpoints.只有您的服务器应该调用订阅端点。 There is no need for an auth handler, as the things you will be doing on the client side only require your clientID on the JS SDK line.不需要身份验证处理程序,因为您将在客户端执行的操作只需要 JS SDK 行上的 clientID。

You may find this information useful: How do you know if a user has paid for a subscription您可能会发现此信息很有用: 您如何知道用户是否为订阅付费

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM