#loterak_unexpected
1 messages · Page 1 of 1 (latest)
👋 Welcome to your new thread!
⏲️ 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.
⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
🔗 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/1228426219616469026
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- loterak_best-practices, 6 days ago, 15 messages
For reference, this is how we are creating the subscription, for which we grab the payment intent client secret, that goes into the confirmPayment function:
Stripe::Subscription.create(
customer: customer.id,
items: [{ price: @consumer_product_price.stripe_price_id }],
discounts: [{ promotion_code: permitted_params[:promo_code_id] }],
automatic_tax: { enabled: true },
payment_behavior: 'default_incomplete',
payment_settings: { save_default_payment_method: 'on_subscription' },
expand: ['latest_invoice.payment_intent']
)
Can you share a checkout session id or request id for creating the session where this happened?
Yes, one sec
cs_test_b1FanCFxjUlWapTN1dFBXyRk3C4wYA0EgwxDByilAv6aLWoLL5fzWNwwgG#fidkdWxOYHwnPyd1blpxYHZxWjA0TGRKPHRBTU9RVG5LVTFHYUFjTHV3TDF9NEpCTmJxMG1nZld%2FS3RGYTJfNkxoN3BxQXxtVzFTYWZ%2FTHdjTGBXf2l8bG12SjxSTmBLfUc1bXNhRzFVMWxENTVTU2I0V3FfQycpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPydocGlxbFpscWBoJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl
Ah they don't have a default payment method set in invoice_settings.default_payment_method on the customer object
See the docs here: https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-customer
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Hm although this is a payment mode session
it is, although it does create an invoice too
That shouldn't matter
With payment sessions most recent saved card should be prefilled according to the above doc. Looking
Ah there's no email on the 1 saved payment method that customer has
A valid billing address, billing name and billing email are required on the payment method for Checkout to prefill the customer’s card details.
Interesting. The payment element I'm using does not ask for an email, could that be it?
could it be because I'm not using the link element? I'm I required to use that in order for email to be appended correctly?
yeah I meant for Stripe to do it automatically. Becuase the payment element doesn't really ask for an email when using the card payment method
I could just update the payment method through the API, I imagine
If you need to collect it, I just recommend creating your own field to collect it on the payment page. You can then just pass it when calling confirmPayment here: https://docs.stripe.com/js/payment_intents/confirm_payment#confirm_payment_intent-options-confirmParams-payment_method_data-billing_details
But yeah for existing payment methods, you can update them with the api
oh the confirmPayment option sounds good, I'll try that.
Since you'll be using your own field to collect email, I recommend setting email to never when creating the payment element as well: https://docs.stripe.com/js/elements_object/create_payment_element#payment_element_create-options-fields-billingDetails-email since some payment method types collect email in the payment element
One last question, to be extra careful
Sure
Could avoiding the email field cause any problems with those payment methods that have an intermediate page? like apple pay, etc
I would assume not, but just in case