Subscription revise with prorata
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I would like to make a system where my clients could upgrade their subscription plans.
Let's say I have a user who has à monthly subscription, and he wants to update it to the annual subscription.
I need it to take place immediately because he has access to more content when he has the annual subscription, but there also needs to be a pro rata on the payment. For example for the monthly subscription he paid €30, but he immediately upgraded to the annual subscription, the annual subscription is €100, so he is going to pay 100 - 30 = €70 for the upgrade. But I need it to be only on the first billing cycle, the following cycle he has to pay €100.
I tried doing this with the subscription/revise endpoint like this:
let paypalSubscription = await fetch(`${process.env.PAYPAL_API_URL}/v1/billing/subscriptions/${subscription.paypal.subscriptionId}/revise`, {
method: "POST",
headers: {
"Content-Type": "application/json",
authorization: `Bearer ${accessToken}`,
},
body: JSON.stringify({
plan_id: planIds[data.planType],
plan: {
billing_cycles: [{
sequence: 1,
pricing_scheme: {
fixed_price: {
currency_code: "EUR",
value: "70"
}
}
}]
}
})
});
It returns me a link for the customer to go and approve the new subscription which looks like this:
https://www.sandbox.paypal.com/webapps/billing/subscriptions/update?ba_token=TOKEN
But first problem, when I go on this page it seems to work, and when I finalize to payment I get this error:
Which translates to: "The system isn't working right now. Please try again later"
When I go to the sandbox account and check my subscriptions the plan update has been done, but the 70€ payment hasn't.
But second problem, when I check the updated subscription it says that it will be 70€ for each billing cycle, but i wan't it to be only for the first one.
Does anyone know how to make this work ?
Thanks in advance
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- setup_fee is ignored when subscription is revised in REST APIs
- Sandbox: Revise subscription returns success but subscription not modified? in REST APIs
- How to tell if a customer subscribed as a guest or a paypal member in REST APIs
- [JS-SDK] Trying to upgrade a subscription with a prorata charge, but still can't understand how in SDKs
- [JS SDK] When I revise subscriptions the price shows incomplete in SDKs