#kevinpedrozacl_api
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
âąď¸ We automatically close idle threads, which makes them read-only. Make sure you stick around to chat in realtime!
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1212155815117717565
đ Have more to share? You can add more detail below, including code, screenshots, videos, etc.
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question. Thank you for your patience!
Hi there! Just so I'm clear, you're creating a Checkout Session in subscription mode for an existing customer, and that existing customer already has a card that they used for a previous payment. Is your goal to autofill the Checkout Session with their previously-saved card?
@rose creek I am creating a Checkout Session in subscription mode for an existing customer and that existing customer DOES NOT have a card that they have used before, so my goal is that the credit card they entered in this new checkout session is stored for off_session payments (like Stripe renewing the subscription product they buy)
Gotcha, okay.
In subscription mode, we'll automatically set up the PaymentMethod used in the Checkout Session for future usage. You won't need to pass any additional parameters when creating the Checkout Session
We'll automatically use the PaymentMethod used in the Checkout Session for renewal payments for that specific Subscription
If you want to use the PaymentMethod from that Checkout Session for future off-session payments, you can. If you want to set the PaymentMethod from that Checkout Session as the customer's default PaymentMethod, you can update the customer: https://docs.stripe.com/api/customers/update#update_customer-invoice_settings-default_payment_method
But how can I call the Update customer endpoint if I don't have the tok_xxx for that credit card, or is it something I can extract from the checkout object ?
You can pull this ID in a couple of different ways. You can make a call to retrieve the Checkout Session, and expand subscription : https://docs.stripe.com/api/checkout/sessions/object#checkout_session_object-subscription
In the response, look at the subscription's default_payment_method
Gotcha! looks like my existing integration is looking at the "sources" object inside the "customer" object, instead of looking at the payment_menthod of the customer. How can I force this pm_xxx to display as item in that "sources" list. Is that possible?
Or, how can I get payment_methods attached to a customer in the GET /customers/:id request?
No, this isn't possible