[JS-SDK] Trying to upgrade a subscription with a prorata charge, but still can't understand how
eLiosh
Contributor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
Jul-09-2023
07:40 AM
Hi to all,
I'm trying to solve an "upgrade your current plan" problem.
I've created two plan for the same product: both have a duration of 1 month, one has a price of 15€ and the second one has a price of 40€.
If a user buyed the cheaper one, I'd like to let him pay the difference if he tries to buy the expensive one.
I've tried with this js-code:
revise_obj.plan = {};
revise_obj.plan.billing_cycles = [
{
sequence: 1,
total_cycles: 1,
tenure_type: "TRIAL",
frequency: {
interval_unit: "DAY",
interval_count: 1
},
pricing_scheme: {
fixed_price: {
value: selector.dataset.prorata,
currency_code: "EUR",
},
},
},
{
sequence: 2,
total_cycles: 0,
tenure_type: "REGULAR",
frequency: {
interval_unit: "MONTH",
interval_count: 1
},
pricing_scheme: {
fixed_price: {
value: selector.dataset.price,
currency_code: "EUR",
},
},
}
];
return actions.subscription.revise(settings.megapro.subscription_id, revise_obj);
But I have this error in developer console:
Error: Revise Subscription Api HTTP-422 response: error:
{
"name": "UNPROCESSABLE_ENTITY",
"message": "The requested action could not be performed, semantically incorrect, or failed business validation.",
"debug_id": "f4150769c579b",
"details": [
{
"field": "/plan/billing_cycles/1/sequence",
"value": "2",
"location": "body",
"issue": "INVALID_BILLING_CYCLE_SEQUENCE",
"description": "The provided billing cycle sequence is not available."
}
],
"links": [
{
"href": "https://developer.paypal.com/docs/api/v1/billing/subscriptions#UNPROCESSABLE_ENTITY",
"rel": "information_link",
"method": "GET"
}
]
}
I've tried also with a setup_fee, but without luck.
Do someone solved this problem ?
Labels:
- Labels:
-
REST SDK
0 REPLIES 0

Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
Related Content
- This currency cannot be accepted for this recipient's account Error During PayPal-Pabbly Integration in REST APIs
- How to add trail billing cycle ? in REST APIs
- I need to integrate a recurring payment with a variable for a pay-as-you-go product in REST APIs
- webhook not send update notification in REST APIs
- paypal recurring payments and ipn management in REST APIs