Immediately charge for subscription changes

后端 未结 4 777
梦谈多话
梦谈多话 2020-12-11 03:03

We are using Stripe payment processing for our customer\'s subscriptions. When users change plans, we want them to be charged immediately for the prorated difference. Stripe

4条回答
  •  天命终不由人
    2020-12-11 03:36

    To take payment for a change of quantity or subscription plan, you need to do the following:

    1. Update subscription with the new changes.
    2. Create an invoice. The thing that confused me by this is that Stripe magically knows to only invoice for the updated subscription items, and not for upcoming billing cycle items.

    3. Retrieve the newly created invoice

    4. Finalise the invoice
    5. Take payment for the invoice This assumes that your customer has a payment method stored.

    Only when all of the steps have been completed, you've successfully charged for the subscription change (and charged for the change only). You can do it all of it in one go. The customer should get an invoice email from Stripe at the end of it.

    As OP says, it gets particularly complicated if the payment fails. The way I see it, you have three choices:

    1. Ignore the failed payment, give the customer access to the service, and hope that they'll pay the next time payment is attempted.
    2. Roll-back the subscription upgrade, warn the customer that payment failed.
    3. Put the entire subscription on hold until the customer pays.

    I'm only mentioning #3 because at times, the subscription upgrade process may be complicated. And the customer, having spent time upgrading their subscription, wouldn't want the work to be undone, for what could be a completely harmless reason (their credit card had expired for example).

    It may be easier, from a development perspective, to mark a subscription as unpaid, than to roll back or to freeze (and then unfreeze) certain parts of the subscription. But you'll then run foul of barring the customer from a service that they have already paid for (their existing subscription) because they couldn't pay for the additional service.

提交回复
热议问题