#windy_code

1 messages ยท Page 1 of 1 (latest)

raven impBOT
dense lakeBOT
#

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.

raven impBOT
#

๐Ÿ‘‹ 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.

idle beacon
weary bloom
#

i don't use it. i use checkout button

idle beacon
#

What is "checkout button"?

weary bloom
#

sorry Payment Request Button

idle beacon
#

Then that information will be on the Payment Method it creates.

idle beacon
#

Okay, so that info should be on the Payment Method.

weary bloom
#

you mean in payment intent after card confirmation, right?

#

paymentIntent.receipt_email

idle beacon
#

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.

weary bloom
#

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

idle beacon
#

That will have a version of the Payment Method, yeah.

weary bloom
#

awesome, i have one more question

idle beacon
#

What's up?

dense lakeBOT
weary bloom
#

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

merry pilot
#

๐Ÿ‘‹ Rubeus needs to step away but I can help take a look

weary bloom
#

Thank you @merry pilot

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

weary bloom
#

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

merry pilot
#

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

weary bloom
#

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'],
  });
merry pilot
#

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)

weary bloom
#

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?

merry pilot
#

I think that's upto you. You can perform customer creation prior to PaymentMethod creation too.

weary bloom
#

but we don't know customer's data

merry pilot
#

Ah Ah I see

weary bloom
#

as we are using Apple Pay, we need to get user's data from Apple Pay button

merry pilot
#

In that case, yeah after payment method creation makes sense

weary bloom
#

so i think the main point is, we need to get the PaymentIntent from subscription

merry pilot
#

Correct

weary bloom
#

gotcha. thanks a lot haha

#

i will let you know once i implemented it successfully, so don't close this ticket ๐Ÿ™‚

merry pilot
#

Just checking in, if you have any follow up questions