Issue
Hi i've been using paypal's sample code but adapted with react-paypal-js.
I'm wondering if there is an example for suspend subscription?
There doesn't seem to be an equivalent suspendSubscription? I tried looking at subscription API but not sure how to adapt that here. Thanks!
<PayPalButtons
createSubscription={(data, actions) => {
return actions.subscription
.create({
/* Creates the subscription */
plan_id: 'P-xx',
quantity: subscriptionCount, // The quantity of the product for a subscription
})
.then((orderId) => {
// Your code here after create the order
console.log("order id created ", orderId)
return orderId;
});
}}
onApprove={(data, actions) => {
console.log('approved data! ', data);
}}
/>
Solution
Suspending a subscription is done with server API calls, so reactjs is not relevant.
See the Subscriptions documentation, which gives an example in curl format
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"
}'
(There is no SDK for Subscriptions API operations; use direct HTTPS API calls with an oauth2 access token)
Answered By - Preston PHX Answer Checked By - Cary Denson (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.