#notjohn-subs-invoices

1 messages · Page 1 of 1 (latest)

wheat fractal
#

so the thing is, it looks like you're creating and paying a PaymentIntent, aside from the Subscription, right?

which sounds like the incorrect approach

is that right?

What you want to do is, collect a card from the customer, attach it to the Customer and Subscription, then change the trial to "end" (I assume you already have a paid Price on the Subscription)?

pallid hearth
#

When the trial is over, the user can choose to pay, but they default to a "free account" state. The trial ends before we collect Payment Method details from the customer.

During the trial, the subscription has a "paid" Price, due to the $0 invoice created for the trial.

I'm not attaching the Payment Method card to the Customer or Subscription until after I create the Payment Intent. I read from this doc on Payment Intents (https://stripe.com/docs/payments/payment-intents#best-practices) "We recommend creating a PaymentIntent as soon as you know the amoun, such as when a customer begins the checkout process..."
At this point in the flow, we don't have a Payment Method yet.

Learn how to use the Payment Intents API for Stripe payments.

upbeat bluff
#

👋 I'm hopping in since @wheat fractal had to go

#

Do you have an example Payment Intent ID or event ID that's showing the empty/null Invoice field?

pallid hearth
#

pi_3K2JA3A6bdLJ2wr31xe8pIza

#

This appears to be the flow and I may be making assumptions.

  1. Subscription created, with Prices, trial end date set.
  2. $0 Invoice created
  3. Trial ends, Draft Invoice is created.
  4. Invoice attempts to charge, no payment method on file, Invoice set to "Retrying"
  5. Subscription is set to "Past due"

Then when the customer is ready to pay / upgrade, I'd like to create a Payment Intent linking the Subscription & Customer, charge them and then have the Subscription and Invoice update accordingly.

upbeat bluff
#

That's a Payment Intent that you created yourself (not part of the recurring Subscription process) - Subscription Invoices will automatically generate these payment intents for you, you should not have to create them yourself.

#

If you look at the invoice from step 3 (Trial ends, Draft Invoice is created.) you should see that it has a Payment Intent linked to it, which you should be able to use

pallid hearth
#

Oh okay, I must have missed that. It looks like it comes off the "invoice.updated" webhook event, is that correct?

upbeat bluff
#

Yup - it should be populated once the Invoice has been finalized

pallid hearth
#

Great, I'll work with that PaymentIntent. Thanks for your help