#windy_code
1 messages ยท Page 1 of 1 (latest)
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.
- windy_code, 14 hours ago, 18 messages
๐ 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/1237466235977859142
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hello! If you're using the Express Checkout Element you can get the information mentioned here: https://docs.stripe.com/js/elements_object/express_checkout_element_confirm_event
i don't use it. i use checkout button
i mean payment request button: https://docs.stripe.com/stripe-js/elements/payment-request-button?client=html#html-js-create-payment
What is "checkout button"?
sorry Payment Request Button
Ah, okay, so you need to configure the Payment Request Button to collect the information you want: https://docs.stripe.com/js/payment_request/create#stripe_payment_request-options-requestPayerName
Then that information will be on the Payment Method it creates.
yeah i already did
Okay, so that info should be on the Payment Method.
you mean in payment intent after card confirmation, right?
paymentIntent.receipt_email
No.
The Payment Request button will create a Payment Method. The information you're asking about will be on the Payment Method. A Payment Intent is not involved at this point.
It'll be under billing_details there.
but i am not sure where i can get that payment method
ahh i get it from event i think
paymentRequest.on('paymentmethod', async (ev) => {
so ev has that user's data
That will have a version of the Payment Method, yeah.
awesome, i have one more question
What's up?
we can subscribe users after payment success, right?
so in the confirmApplePay({ membershipPlan, address, email }); section, we can create Customer, Subscription, and then subscribe for that customer and subscription. right?
cc @idle beacon
๐ Rubeus needs to step away but I can help take a look
Thank you @merry pilot
Are you trying to pre-charge customers for the subscription? Like making sure the payment goes through before you create a subscription? If so, yeah you can create a subscription after the payment is successful.
Ideally you'd want to listen to webhook events and handle customer/subscription creation server-side
no pre-charge. but i am just implementing Apple Pay Subscription
I use Payment Request Button for Apple Pay Button
I will need to know the flow, maybe best practices
Gotcha. How exactly are you creating the PaymentIntents at the moment?
Typically the flow would look something like;
1/ Create a customer
2/ Create a subscription
3/ From the subscription, you'd retrieve the latest_invoice.payment_intent
4/ Use that PaymentIntent's client-secret with PaymentRequestButton to confirm payment
for now, i create Paymentintents manually when app starts
const paymentIntent = await stripe.paymentIntents.create({
amount: Number(membershipPlan.costOfMembership) * 100,
currency: 'usd',
payment_method_types: ['card'],
});
Gotcha. PaymentIntents are used for one-time payments. So your current flow will charge users $x amount just to save payment method and start a subscription.
You can't associate this payment to a subscription (unless you provide a trial period for the duration for the amount you're charging)
ok then i will need to follow the flow that you shared above from 1) to 4) ๐
so before creating a customer, i think we need to add one more step
0/
- stripe.paymentRequest
- check
canMakePayment - receive PaymentMethod
paymentRequest.on('paymentmethod', async (ev) => {
// do the steps from 1) to 4), coz, we can get user's data here from "ev"
}```
right?
I think that's upto you. You can perform customer creation prior to PaymentMethod creation too.
but we don't know customer's data
Ah Ah I see
as we are using Apple Pay, we need to get user's data from Apple Pay button
In that case, yeah after payment method creation makes sense
so i think the main point is, we need to get the PaymentIntent from subscription
Correct
gotcha. thanks a lot haha
i will let you know once i implemented it successfully, so don't close this ticket ๐
Just checking in, if you have any follow up questions