#Kaartik - Checkoutn Session
1 messages ยท Page 1 of 1 (latest)
Hi ๐
That depends on what you want
You can review both approaches here:
https://stripe.com/docs/payments/accept-a-payment
I want to allow for my users to make a singular payment
And I want to store the customer data so that when they intend to make another payment, their card details are stored
Sorry Idt the link explains the differences of checkout session and payment intent @rustic grove
Checkout Sessions are built around the front-end and they will generate payment intents themselves. Checkout just provides a Stripe hosted UI to collect payment while with Payment Intents it is up to you to build the UI
If you just want to create a customer record and save payment details for later use, that can be done with either Checkout Sessions or Payment Intents
Okay thank you!
I would strongly suggest some reading and perhaps even building some simple test integrations with the doc I linked. For me, I find I don't really get a technology until I start building something with it.
Thank you for that, I'm in the midst of building some Stripe integrations right now in fact!
I have one question though
CustomerCreateParams params =
CustomerCreateParams.builder()
.build();
Customer customer = Customer.create(params);
This ^ is the snippet of code that is used to create a Customer correct?
Yeah, an empty one but it creates a customer
My question is, how does Stripe like that customer to the appropriate account ID?
It doesn't. Stripe Customers and Stripe Accounts are totally different things
Or do you mean to your account?
Ah okay
My bad for the mix up
I left my Stripe code for a week and just came back to it
Yeah that makes sense
I link it to my account by setting the api key right
Just to confirm ^
Yup, so all the requests to the API are signed with your API keys so we know who is making the request
So all records created as a result of that request are for the account identified by those API keys
Got it, that makes sense
One final question please
So therefore, when I create a customer object
How does it save my card data for future purchases
We've got a doc for that
my client's card data*
two actionally
Yah those docs would be super helpful
Save without charging: https://stripe.com/docs/payments/save-and-reuse
Save during a charge: https://stripe.com/docs/payments/save-during-payment
Sure thing! Happy to help ๐
Wait sorry, but from the second link to save during a charge, it seems like I'll have to use a Payment Intent (meaning I'd have to create my own UI) to save the card data.
I was intending to use Checkout Session, create a Customer and save their payment data for future purchases. Does that mean I cannot save their card details for future purchases by using Checkout Session?
Okay nope you can do that too
Set mode to setup if you don't want to charge
https://stripe.com/docs/api/checkout/sessions/create
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Or setup future usage (which is Payment Method specific) to save during a charge
https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-payment_method_options-card-setup_future_usage
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Ah okay
I will play around with this code. I should be able to figure it out
But hey thanks a lot for the crystal clear clarifications
Sure thing! Happy to shed what ๐ก I can