#delgesu1745_api
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/1346906251849629699
๐ 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.
- delgesu1745_api, 1 hour ago, 4 messages
- delgesu1745_api, 9 hours ago, 18 messages
Hi ๐
In that case, you would specify mode: "setup" parameter when you create the Checkout Session
We have an integration guide specifically for this workflow here
๐ Hey. Ok! So then then would I not show any of the product info details, or can I still show that so they know what they're going to be paying for, when we initiate the payment?
If you are using Stripe Checkout to save a payment method, no you would not display product information in that UI.
Can you clarify why you want to save the payment method and then initiate payment?
Since you can do both with the same Checkout Session
Sorry if confusing! The primary thing I want to achieve is not charging them immediately upon checkout. We first have to verify that we can give them a scheduled time for the service before we bill them, but I do want to show them the breakdown of the things they're signing up for.
Gotcha. Okay. Unfortunately when you specify Setup, you cannot provide line items so we won't be able to display any details on what the customer is purchasing in the Checkout Session UI.
In that case you would likely need to add your own UI displaying this information before you redirect the customer to Stripe Checkout.
Ok, got it. So looking over the guide, step 3 and beyond. https://docs.stripe.com/payments/checkout/save-and-reuse?payment-ui=stripe-hosted#retrieve-setup-intent is just need when you're ready to process the payment, but the payment method add in the checkout could be used later to process payments directly through invoices (as an example) or do I have all wrong?
Yes, you can save the payment method to teh customer to charge at a later time, yes. You'll need to update the customer, https://docs.stripe.com/api/customers/update#update_customer-invoice_settings-default_payment_method to set this that payment method as the deafult for the customer's invoices.
But if include the customer_id in the session do I need to followup with updating the customer invoice settings?
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://dashboard.stripe.com/apikeys
const stripe = require('stripe')('sk_test_u7epv5S7nj4EDqZDGZNqyDUV');
const session = await stripe.checkout.sessions.create({
mode: 'setup',
currency: 'usd',
customer: '{{CUSTOMER_ID}}',
success_url: 'https://example.com/success?session_id={CHECKOUT_SESSION_ID}',
});
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
That is up to you, you do not need to if you pass the payment method id when you create the invoice, https://docs.stripe.com/api/invoices/create#create_invoice-default_payment_method.
Or, you can update the customer in the first places, and just create the invoice to charge automatically at a later time.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Ok, but how does the session attach the payment method to the customer if passing a customer id to it? Does it set it as the default?
It attaches the payment method to the customer but it does NOT set it as the deafult. Hence, you would need to make another request update the customer to set that
Ok got it. But if it's the only payment method on file for the customer then is it by default set as, uh, the default?
Another item I need clarified. The guide in step 2 says "Append the {CHECKOUT_SESSION_ID} template variable to the success_url to get access to the Session ID". Where do you get the checkout session id from exactly?
No, it does not automatically become the default
You just add {CHECKOUT_SESSION_ID} template variable to the success_url and that would be pulled in for you. I recommend that you test that on your end.
Ah ok so you leave that as is. And so then I need to setup the template for the session in the dashboard or something?
Hmm what do you mean by that? The URL will be appended and it has nothing to do with the 'Dashboard'
I highly recommend that you test this as it get fun to play around
I am in the Stripe Shell right now on the guide playing with it.
When I add my test account customer id and run the sessions create call it spits back the json for the sessionn.
Sorry for all the dumb questions, but how is this then rendered in the browser to the client?
Oh I see. It returns the url that you then have to serve up to the user by opening the url in a browser for them?
Ok, I think I can test this all out now in a real example. Last question. So what I meant by customize the template above is that checkout session url that's returned, when you open that, where and how do I customize that?
You shared the code above:
const session = await stripe.checkout.sessions.create({
mode: 'setup',
currency: 'usd',
customer: '{{CUSTOMER_ID}}',
success_url: 'https://example.com/success?session_id={CHECKOUT_SESSION_ID}',
});
I do not fully understand the question
Are you able to reword it please?
Sorry. Ok so I just want to know how I can customize the content of this url: https://pay.musickids.us/c/pay/cs_test_c1Dfe9FbLl8EmKnq4bbk4PABBzvryAbB6wixQVg5KqpZ0iXjpVolZ1yfSy#fidkdWxOYHwnPyd1blpxYHZxWlNiVlVCTnZVQGdMS2k2Q118fX1EaHRkVycpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl
Is that all done in the sessions.create call?
Or can I set some defaults up within my Stripe settings in our account?
I see in the guide you sent actually that you can do it in the create call: https://docs.stripe.com/payments/checkout/customization/policies
But yeah is there a way to set some defaults in the settings for stuff like this?
Appending the success url and customizing the checkout domain URL: https://docs.stripe.com/payments/checkout/custom-domains?payment-ui=stripe-hosted are seaparte
That is https://docs.stripe.com/payments/checkout/customization/policies talking about customizing policies etc and not the URL.
You can look at what settings can be controlled in the Dashboard: https://docs.stripe.com/payments/checkout/customization/policies?payment-ui=stripe-hosted#policies
Yeah, ok, I'll check this all out more and will reach out if I have more questions. Thanks so much for all your help!
Sure