I have a react app which has a Paypal subscription option. This all works perfectly.
I am just trying to add a function to allow user to pause their subscriptions.
There is a piece of code on the Paypal developer site to do this, I am just not sure how to edit this code to work in react:
curl -v -X POST https://api-m.sandbox.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G/suspend
-H "Content-Type: application/json"
-H "Authorization: Bearer <Access-Token>"
-d '{
"reason": "Customer-requested pause"
}'
The link to the page the code came from is: https://developer.paypal.com/docs/subscriptions/customize/pause-resume/
React.js is a front-end web framework. API calls to api-m.*.paypal.com (with a client ID and secret to first obtain and access_token) are to be done from a backend, often node.js when paired with react but can be anything.
So, the how of your question depends on what backend you are using. You'll be doing your API calls from there.
If it's node.js , fetch and axios are two of the most common function/libraries to do requests with.