简体   繁体   中英

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

/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

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?

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

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?

Don't do that. Fetch calls should go to your server. 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.

You may find this information useful: How do you know if a user has paid for a subscription

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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