#mo.dankwambo

1 messages ยท Page 1 of 1 (latest)

solemn ferryBOT
spare slate
spiral thicket
#

I initially ensured that we had the payment methods added to the Invoice template [screenshot 1] and the payment method [screenshot 2] on the Stripe dashboard.

Then I used the curl command to change the billing cycle of an existing subscription, in order to simulate the end of the subscription period and trigger the automatic invoice generation quickly [3]. This successfully created the payment intent on Stripe here (https://dashboard.stripe.com/test/events/evt_3MFbEzKl7yri9QNL0HuOgfFh). You can still it only shows the card as the payment_method_types

[3]
curl https://api.stripe.com/v1/subscriptions/SUB_ID
-u SECRET_KEY:
-d billing_cycle_anchor=now
-d proration_behavior=none

spiral thicket
spare slate
#

The customer has a saved Card PaymentMethod already, that's why for the PaymentMethodTypes there were only the card option

spiral thicket
#

@spare slate That's one of the first things I tried but it sends me back an error along the lines of โ€œSome of the parameters you provided ([parameter]) cannot be used when modifying a PaymentIntent that was created by an invoice. You can try again without those parameters.โ€.

This signals that there are some details or parameters that we canโ€™t update on an existing PaymentIntent, especially if itโ€™s related to amending the transaction details (payment methods, total transaction amount, etc.)

https://support.stripe.com/questions/cannot-update-a-paymentintent-to-include-customer-information-after-confirmation

spare slate
#

Ah yes the PaymentIntent was created by Subscription update and for an invoice, true.

#

If the customer want to use another PaymentMehtod type rather than the one saved, you need to update the customer default PaymentMethod, then issue an invoice

spiral thicket
#

I'm not sure I understand this

#

How can we update the default payment method to a payment method that hasn't been added yet?

spare slate
#

Let me summarize this better, actually the customer cus_M8R85ufOOWcEzI has a saved card PaymentMethod. When creating a new Invoice for a subscription action, the related PaymentIntent can be paid by the customer saved PaymentMethod or an other PaymentMethod with the same Type of the saved PaymentMethod. If your customer want to use another PaymentMehtod type, then you need to collect the new PaymentMethod ( for example: https://stripe.com/docs/payments/save-and-reuse?platform=checkout)
Then you update the customer payment method:
https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method
Then you invoice the customer for that subscription update

spiral thicket
#

Hhmn, so you're basically saying create a new setup intent with the new payment method, then saving it as the customer's default, then cancelling (voiding) the present invoice, then creating a new one?

That seems like a very long way around it tbh. Will also be very messy to implement

spare slate
#

Yes agree, that's because the customer has already saved PaymentMehtod, so the easiest way is to use that pre-setup PaymentMethod (e.g. Card for this customer)

spiral thicket
#

Yeah, I see what you mean. I was hoping I'd get a magic answer to take all my problems away but I guess that's not possible.

Would it be possible to create a new payment intent (after the invoice has been generated automatically) and then update the invoice's payment intent to the new one? Or would Stripe reject that as well as the invoice has been generated (similar to updating the payment intent after creation)?

spare slate
#

Nope you can't also do that, you need to use the PaymentIntent created by the Invoice.

spiral thicket
#

Haha, fair enough! Thanks for all your help!

spare slate
#

With my pleasure, don't hesitate to come back if you have any follow up Question ๐Ÿ™‚