#faz-ApplePay

1 messages · Page 1 of 1 (latest)

unborn vector
#

Hi there, the fastest way to start using subscription is via Stripe Checkout in subscription mode. You can pass in an existing product, or create an ad-hoc product when creating the Checkout Session.

The Checkout page support Apple Pay out-of-the box, so you can save the trouble of setting up Apple Pay in your own website.

silent pagoda
#

I'd like to set up the subscription without using Checkout, and i've already got apple pay set up on my own website. I'm just not sure how to set up the apple pay for a subscription

#

I've already been able to set it up for one-time payments

#

I'm not sure how to retrieve the card token? Should I change the listener to 'token' instead of 'paymentmethod'? And then how do I make the new customer with just a card token and no payment method?

unborn vector
#

You can take a look at it and see if you want to build the subscription page by yourself. I'd strongly recommend to to use Checkout though.

silent pagoda
#

I've built a payment intent using the information passed from the apple pay button, but now i'm receiving the status requires_confirmation in my payment dashboard and i'm not sure how to continue? I've already tried running stripe.confirmCardPayment upon receiving this status but haven't had any luck. Any suggestions?

unborn vector
#

Can you give me the PaymentIntent ID?

silent pagoda
#

There's a couple, but this is the most recent: pi_3KiCgDD7lOuiuDEB0kkYpN4s

unborn vector
#

I don't see any requests to confirm this PI.

silent pagoda
#

yea, i'm just now realizing i ran a confirmcardpayment function in the wrong part

#

however i'm not sure what's the correct way to do it

#

i'm returning paymentintent object from my paymentintent creation on backend

unborn vector
#

If you are using the Payment Request Button API then yes you can call stripe.confirmCardPayment to confirm the payment

silent pagoda
#

do i then use confirmcardpayment

#

ok

#

do i have to use confirmcardpayment before or after making the subscription

#

because at the moment i'm putting it after, based on the logic in my code that was already there for non-apple pay subscriptions, which is that the card payment was confirmed after the subscription was created

unborn vector
#

sorry I'm not clear on your question. can you show me the code?

silent pagoda
#

you see how i'm calling the "subscribe" function before doing the card payment confirmation

#

this worked for me in non-apple pay payments but seemingly not for apple pay

unborn vector
#

And what does this subscribe function do?

silent pagoda
#

makes a customer, product, and subscription

#

returns client secret, status, and customer id

unborn vector
#

OK, and where do you get the paymentIntent?

silent pagoda
#

for the subscription? the payment method is passed in the request body

#

for the third-party-pay function, payment intent is created in the function

#

that's the third-party-pay function code

unborn vector
#

Hmm, one sec. let me zoom back. We are discussing the payment confirmation for subscription right. I'd like to know how did you get the paymentIntent(or clientSecret) after creating the subscription. Can you share with me the code what you wrote in the subscribe function?

silent pagoda
#

subscribe function code

unborn vector
#

So the payment method can be ready for off_session subscriptions payments.

silent pagoda
#

didn't do anything

opaque wolf
#

Hi! I'm taking over Jack Tan. So if I understand correctly you are trying to create a subscription using Apple Pay?

silent pagoda
#

yea

#

are you able to see my code screenshots above

opaque wolf
#

Where exactly are you stuck? Do you get an error message? Can you share a PaymentIntent ID?

silent pagoda
#

error messages are supposed to be going through to my slack channel, but they don't for some reason

#

latest payment intent id is pi_3KiDebD7lOuiuDEB1ZPDATNH

opaque wolf
#

Thanks! I see this PaymentIntent was created successfully, but you never tried to confirm it. So you need to call confirmCardPayment().

silent pagoda
#

i am calling it, after subscription creation and before opening customer billing portal

#

doesn't seem to work

#

in fact now i'm unable to complete apple payment