#melodyclue

1 messages · Page 1 of 1 (latest)

indigo yarrowBOT
broken prairie
#

hi! you can create a PaymentIntent at any time. Can you say more about the use case exactly?

formal wolf
#

ok, I want to charge the difference in subscription costs when I upgrade my subscription. (instead of pro-rating).

broken prairie
#

makes sense. Then sure, when you calculate that amount you can create a PaymentIntent for it against the customer's saved card (https://stripe.com/docs/payments/save-and-reuse?platform=web&ui=elements#charge-saved-payment-method), or you could create a one-off invoice for it(https://stripe.com/docs/invoicing/integration); or you could add the amount as an InvoiceItem so it's charged in the next subscription invoice(https://stripe.com/docs/billing/invoices/subscription#adding-upcoming-invoice-items) .

formal wolf
#

This may be a silly question, but could creating a paymentIntent on the webhook paymentIntent.created result in an infinite loop?

broken prairie
#

yes

formal wolf
#

ok, As long as you take care of that, you can use the stripe sdk freely on the webhook!

indigo yarrowBOT
last eagle
#

👋 taking over for my colleague. Let me know if there's any follow-up Qs I can answer!

formal wolf
#

Hi , I was wondering if it is OK to use the stripe sdk on webhook and asked the question. I have come to the conclusion that you can use it, but you have to be careful about infinite loops!

#

Probably not, but is there an option to charge the difference in the cost of the plan when the plan is UPDATED, rather than pro rata?

last eagle
#

but you'd have to do it using add_invoice_items

#

instead of the prorations way

formal wolf
#

Okay, so you're saying you're going to disable the proportional allocation and add to the invoice item as the difference?

last eagle
#

yes

#

exactly

#

so you update the price with prorations "none" and billing_cycle_anchor: "unchanged" and you add the difference as add_invoice_item

formal wolf
#

This will be reflected in the next invoice?

last eagle
#

yes

formal wolf
#

ok!

last eagle
#

unless you create the invoice for the subscription & customer and "pay" it immediately in your code

formal wolf
#

Is there a property that sets it up?