Make paypal subscriptions API request to get subscription info on server – auth wrapper? Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of Make paypal subscriptions API request to get subscription info on server – auth wrapper? without wasting too much if your time.

The question is published on by Tutorial Guruji team.

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

Answer

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

We are here to answer your question about Make paypal subscriptions API request to get subscription info on server – auth wrapper? - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji