Home > database >  Will stripe.customers.createBalanceTransaction charge customer's credit card?
Will stripe.customers.createBalanceTransaction charge customer's credit card?

Time:05-19

I am trying to create a workaround to make sure the customer has sufficient funds before to upgrade him to another tier. I am using stripe.customers.createBalanceTransaction in development mode but I am not sure how it will behave in a production environment. Does it charges the customer's credit card to add funds ?

If not, how can I manage to make the customer pay before upgrade him to the upper tier ?

CodePudding user response:

Creating a customer balance transaction [0] will not charge your customer’s credit card. This will only add/subtract the balance on the customer [1] which will be applicable to their future invoices. It has nothing to do with charging your customer’s credit card.

To upgrade a subscription [2] only after your customer pays the price difference, you can update the subscription [3] and charge the customer for it right away by passing payment_behavior: 'pending_if_incomplete' and proration_behavior: 'always_invoice'[4]. If the payment fails, your customer will not be upgraded to the upper tier.

[0] https://stripe.com/docs/api/customer_balance_transactions/create

[1] https://stripe.com/docs/billing/customer/balance

[2] https://stripe.com/docs/billing/subscriptions/upgrade-downgrade

[3] https://stripe.com/docs/api/subscriptions/update

[4] https://stripe.com/docs/billing/subscriptions/pending-updates

  • Related