Kvetoslav
Kvetoslav

Reputation: 602

Stripe subscription renewal - emailing the invoice instead of automatic charging

According to Stripe documentation concerning Subscription renewal invoices "When an invoice is due, Stripe tries to collect payment by either automatically charging the payment method on file, or emailing the invoice to customers."

But I cannot find in the Stripe API how to set up emailing of the invoice for subscription renewal instead of letting Stripe automatically charge existing customers. Automatic charging seems like a default option that cannot be changed through the API as future payments are generated automatically.
My flow should be customer trendily:

I find it not too customer friendly to charge him/her automatically. Yearly subscription may be too long for the customer to remember his/her subscription or even worse he/she has provided payment data to Stripe to store and use. It is better to avoid any unexpected customer surprise.

Thank you very much.

Edit: I have already tried this without any success.

     const session = await stripe.checkout.sessions.create(
      {
        customer: stripe_customer, 
        mode: "subscription",
        payment_method_types: ['card'],
        line_items: [{
          price: priceId,
          quantity: 1
        }], 
        automatic_tax: {
          enabled: true,
        },
        collection_method: "send_invoice", // or data: [{ collection_method: "send_invoice"}],
        customer_update: {
          address: 'auto',
        },
        success_url: "http://localhost:5173/payment/success",
        cancel_url: "http://localhost:5173/payment/canceled",
      }
    )

Upvotes: 0

Views: 1404

Answers (1)

karbi
karbi

Reputation: 2163

You can create a Subscription that automatically emails Invoices to customers by setting collection_method: send_invoice (see https://stripe.com/docs/api/subscriptions/create#create_subscription-collection_method). You may also find it helpful to read some of their invoice-specific documentation that covers this: https://stripe.com/docs/invoicing/integration

Edit - You left out the detail you were using Checkout Sessions initially, which changes things. There is no way to directly create a Subscription through Checkout that has collection_method: send_invoice. If you using Checkout is a hard requirement then you need to do the following:

  • Create the Checkout Session
  • Provide payment in the Checkout UI. Once payment is complete this will create a Subscription with collection_method: charge_automatically
  • After it's been created, update the Subscription to set collection_method: send_invoice so that all future renewals email the invoice to the customer.

Upvotes: 3

Related Questions