#Nancy-Apple-Pay

1 messages · Page 1 of 1 (latest)

golden grove
agile brook
#

Yes, I have the PaymentRequestButtonElement implemented, but is stuck on passing the paymentMethod return by the paymentMethod event to the server side. Currently, we pass a token generated from cardElement to attached on the the stripe customer/subscription. How can i turn whats returned in payment Method into a token

#

I see that the stripe.createToken only takes in CardElement and StripeCardNumberElement

#

whereas I have a payment method right now from apple pay that need to get somehow stored in stripe customer/subscription

golden grove
#

A PaymentMethod can be used the same as a token

#

Tokens are actually legacy at this point

#

And PaymentMethods are our newer API

#

So you can attach a PaymentMethod to a Customer just like you would attach a Token

agile brook
#

Sorry, I am going to take a step back and ask a few more questions:

  1. The Apple pay will be used a subscription. Does this mean we have to create a setupIntent to save the card for future usage?
  2. Regarding the total field requested in payment request, if we have a trial or coupon in place for an subscription how do we display the total and charges after that?
golden grove
#

No you wouldn't have to use a SetupIntent. You could grab the clientsecret from the initial invoice of the Subscription and pass that to confirmCardPayment and use that with PaymentRequestButton.

#

For the second question, you would update the paymentrequest total based on the Subscription

#

However you can't customize the modal to state something about a trial

agile brook
#

question regarding payment method (as you mentioned it to be used the same as token). Is there a way to create payment method from cardelement instead of creating token if we are to migrate it?

golden grove
agile brook
#

While reading the documentation - I noticed that payment method is attached on paymentMethod field in Customer, whereas the old token was stored in source. If we are planning to depreciate token and use payment method. What happens when a customer happens to have a paymentMethod and source? For new customer created they will have only paymentMethod, however for old customer they will have a source and only if they update their payment method will the have a new paymentMethod, but they will still have a source?

lethal oyster
#

We built things as backwards compatible

#

So if someone has a card_123, it works as a PaymentMethod in the API

#

so mostly you can just migrate to PaymentMethods

agile brook
#

do you mean card_123 as source?
Sorry, I am a bit confused. If an exisiting customer have an exisiting source , and we are updating to attached a paymentMethod, won't they have two variables now. Will it just take the paymentMethod as main source of payment? Or will we need to remove the source, while adding the paymentMethod

lethal oyster
#

hmmm sorry I'm not following you now

#

there's no source

#

there's sources on Customer which is a collection of "payment sources" which is considered legacy. It's when you used to use Token (tok_123) and then turn them into Card objects (card_123)

#

Now the newer API is the PaymentMethod API (pm_123)

#

When we built this in 2018, we made sure that all "legacy objects" continue to work so that no one had to collect card details gain for existing customers

#

does that make sense?

agile brook
#

sorry, I do mean sources. So currently we are using sources and is planning on migrating to paymentMethod. My concern is what happens when a customer used to have sources > basically tokens from cardElement , and now instead of us updating 'sources' we are updating the payment_method (https://stripe.com/docs/api/payment_methods/attach). What happens when they have both 'sources' and payment_method?

lethal oyster
#

that's kinda what I explained above

#

you seamlessly ignore sources and solely use PaymentMethods moving forward

#

and all existing "payment sources" will still work on the new API

#

Like say you have a customer with card_123 and card_ABC and now you add pm_123 now that Customer has all 3 as a PaymentMethod, they all work via the new API and the PaymentIntents API