Quantcast
Channel: Active questions tagged paypal - Stack Overflow
Viewing all articles
Browse latest Browse all 475

How to charge proration free on subscription revise paypal

$
0
0

I'm building a feature to allow users to upgrade their plans with proration in paypal. But I can't figure out how to charge them a proration fee I calculated

Here is what I've triedAssume that this is a call to /v1/billing/subscriptions/{sub}/revise?

  request.requestBody({    plan_id: event.parsed_body.planId,,    application_context: {      brand_name: 'Sample brand name',      locale: 'en-US',      shipping_preference: 'SET_PROVIDED_ADDRESS',      user_action: 'SUBSCRIBE_NOW',      payment_method: {        payer_selected: 'PAYPAL',        payee_preferred: 'IMMEDIATE_PAYMENT_REQUIRED',      },      return_url: process.env.HOME_URL +'/infos/subscriptions?upgrade=1',      cancel_url: process.env.HOME_URL +'/?cancel=1',    },    plan: {"billing_cycles": [        {"frequency": {"interval_unit": "YEAR","interval_count": 1          },"tenure_type": "TRIAL","sequence": 1,"total_cycles": 1,"pricing_scheme": {"fixed_price": {"value": Number(prorationDetails.prorate_fee).toFixed(2),"currency_code": "USD"            }          }        },        {"frequency": {"interval_unit": "YEAR","interval_count": 1          },"tenure_type": "REGULAR","sequence": 2,"total_cycles": 0,"pricing_scheme": {"fixed_price": {"value": Number(prorationDetails.next_billing.amount).toFixed(2),"currency_code": "USD"            }          }        }      ],    }  });  let response = await client.execute(request);

This is me trying to charge them the proration fee for the trial period but then moving them to a normal cycle. This results in a error from paypal saying "The provided billing cycle sequence is not available"


Viewing all articles
Browse latest Browse all 475

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>