#dam-invoice-paymentmethod
1 messages ยท Page 1 of 1 (latest)
a checkpout session in type "setup"
Hi again ๐ after the new Payment Intent is created via the Checkout Session, you'll need to set it as the Customer's default payment method for invoices.
To do so you would make a request to update the Customer record, providing the ID of the newly created Payment Method into the invoice_settings.default_payment_method field:
https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method
yes, thank you, but in checkout.session.complete response i dont' have one,
this one is a checkout session in type "setup"
Apologies, that is expected. The Payment Method is not stored directly on the Checkout Session, but is rather stored on the associated intent. Since your Checkout Session was created with mode set to setup, then the information that you're looking for will be on the associated Setup Intent.
You can find the related Setup Intent in the setup_intent field on the Checkout Session:
https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-setup_intent
You can then retrieve that Setup Intent by its ID:
https://stripe.com/docs/api/setup_intents/retrieve
And then find the ID of the related Payment Method in the payment_method field:
https://stripe.com/docs/api/setup_intents/object#setup_intent_object-payment_method
a ok, now i understand, i'll try right now, thank you ๐
dam-invoice-paymentmethod
ok, the invoice will attempt the payment by 1 hour...in the meantime i was thinking...is it possible to know the id of the subscription that will be created, i mean, when i created a scheduleSubscriton I have a
"id": "sub_sched_1Lmg7lGoNCcKF08Jor2JPq74",
so the id of this will be this id without sched_:
sub_1Lmg7lGoNCcKF08Jor2JPq74? @slow ice thank you again
no
But the Schedule has a subscription property: https://stripe.com/docs/api/subscription_schedules/object#subscription_schedule_object-subscription
a ok, Perfect! thank you
but if the subscritprion does not exist yet this filed is empty? Because i'm having this issue, thank you
if the Subscription hasn't been created yet it's empty, and there's no way to know the id the subscription will have until after it's created.