#salim-bt_docs

1 messages ยท Page 1 of 1 (latest)

unkempt stumpBOT
#

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

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

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.

carmine rover
#

hello! hope you're doing well!

const expressCheckoutElement: Ref<any> = ref()

const requestOptions: ElementsOptionsInterface = {
mode: 'subscription',
amount: totalAmount.value,
currency: CURRENCIES.USD,
paymentMethodCreation: 'manual'
}

const eceOptions: EceOptions = {
layout: {
maxColumns: 1,
overflow: 'never'
},
paymentMethods: {
applePay: 'always',
googlePay: 'always',
amazonPay: 'auto'
}
}

elements.value = stripeInstance.elements(requestOptions)
expressCheckoutElement.value = elements.value.create('expressCheckout', eceOptions)
expressCheckoutElement.value.mount('#express-checkout-element')

hello, as you see we use paymentMethodCreation: 'manual', but in this case amazon pay button not renders. Is it not supported if paymentMethodCreation: 'manual'?

slow sentinel
#

Hello! No, I don't believe that approach is supported, but let me confirm...

carmine rover
#

ok thank you!
waiting

slow sentinel
#

Doesn't seem to be supported. Can you tell me what you're trying to build?

carmine rover
#

we has subscription system, and i am using express chekout element

#

does amazon supported in subscription?

#

if amazon supported with paymentMethodCreation: 'manual'

slow sentinel
#

Amazon Pay supports Subscriptions, yes, but I don't think Subscriptions require paymentMethodCreation to be set to manual.

carmine rover
#

well can you confirm

slow sentinel
#

Are you using just the Express Checkout Element or are you using the Payment Element as well?

#

Confirmed it should work just fine.

#

Is it not working for you?

carmine rover
carmine rover
slow sentinel
#

No, I mean if you remove paymentMethodCreation: 'manual' does Amazon Pay show up?

slow sentinel
#

Amazon Pay + Express Checkout Element without paymentMethodCreation: 'manual' should work just fine to create a Subscription.

carmine rover
#

ok thank you so much

slow sentinel
#

Happy to help!

carmine rover
#

wait

#

but we need with paymentMethodCreation: 'manual'

slow sentinel
#

Why?

carmine rover
slow sentinel
#

Why are you using createPaymentMethod?

carmine rover
#

sec

slow sentinel
#

Most integrations do not need or use createPaymentMethod, which is why I'm asking.

carmine rover
#

pm id i getting from stripe.createPaymentMethod()

#

how attach card to user then?

slow sentinel
#

Normally you would run stripe.confirmPayment which would confirm the payment client-side and create the Payment Method all in a single step.

carmine rover
#

ok sec let me ckeck

#

we can't use stripe.confirmPayment

#

it needs clientSecret, but all our logic located on backend
PaymentIntent creates on backend

slow sentinel
#

For a Subscription you shouldn't be creating a Payment Intent directly.

carmine rover
#

frontend only attach cards

unkempt stumpBOT
slow sentinel
#

And then add Express Checkout Element to that once you're done.

unkempt stumpBOT
carmine rover
#

ok let me see

#
  • we can't use stripe.confirmPayment
  • we need createPaymentMethod. But it not works with paymentMethodCreation: 'manual'

no way to solve it?

rapid saddle
#

๐Ÿ‘‹ stepping in for my colleague here

carmine rover
#

?

pale gate
#

hello, is it possible get selected credit card data from express checkout?

unkempt stumpBOT
#

@pale gate looks like you're in the wrong place, this thread is for someone else's question.

Note that posting inappropriate messages in other people's threads is against the rules. No worries if this was just an honest mistake, but anyone who violates the rules multiple times will be removed from this server.

pale gate
#

inside elements.create('expressCheckout', eceOptions).on('confirm') event

rapid saddle
#

Ah, alright, thanks for clarifying

pale gate
#

and 2nd Q.

const expressCheckoutElement: Ref<any> = ref()

const requestOptions: ElementsOptionsInterface = {
mode: 'subscription',
amount: totalAmount.value,
currency: CURRENCIES.USD,
paymentMethodCreation: 'manual'
}

const eceOptions: EceOptions = {
layout: {
maxColumns: 1,
overflow: 'never'
},
paymentMethods: {
applePay: 'always',
googlePay: 'always',
amazonPay: 'auto'
}
}

elements.value = stripeInstance.elements(requestOptions)
expressCheckoutElement.value = elements.value.create('expressCheckout', eceOptions)
expressCheckoutElement.value.mount('#express-checkout-element')

here is part of our code. I passing paymentMethodCreation: 'manual' to run stripe.createPaymentMethod() inside express checkout. But if paymentMethodCreation: 'manual' amazon pay button not renders

rapid saddle
#

So from reading this thread, it seems like your goal is to use the Express Checkout Element to create a payment method and then create the Subscription on the backend with that payment method afterward, is that correct?

pale gate
#

yes

#

we are creating payment method, then i getting pm id on frontend, then send it to backend, to attach the payment card

#

after that we create subscription by sending request from frontend

#

all logic located on backend

#

from frontend, i just send request to attach credit card, and sending request to create subscription

rapid saddle
#

Testing currently, will follow up shortly

pale gate
#

first issues with express checkout are:

  • not found way how get selected credit card data from express checkout

i need get selected credit card to check, if this card was already attached to user or not.

  • If card has been attached, i need just run request to backend to set this card as default
  • If card has NOT been attached, i need get card data from express checkout, pass it to backend, to create and attach this card. But i have not found way how to get selected credit card data from express checkout. So i creating payment method from frontend using stripe.createPaymentMethod(). Then i am getting pm id and passing it to backend, so backend attach this card.
#

but here we found 2nd issue:

  • stripe.createPaymentMethod() not works without paymentMethodCreation: 'manual' setting
#

if paymentMethodCreation: 'manual' applied, then amazon pay button not renders

#

to solve issue with defining credit card already attached or not, we decided remove all gpay/apple pay cards, then create new one on each payment, to illuminate credit cards duplicates

granite flax
#

Stepping in here as I think I was talking to your team earlier.

For ApplePay and GooglePay, what you're trying to achieve won't work. Apple and Google will automatically generate a new card number called a DPAN (Device PAN) with a new expiration date. They won't send us the real card details so when we create the fingerprint, we use the DPAN to create a fingerprint. When the end customer adds the card on a different device, we get a new DPAN and a new fingerprint. For this reason, you can't deduplicate this and you would get 2 separate fingerprint for the same card.

#

i need get selected credit card to check, if this card was already attached to user or not.
If card has been attached, i need just run request to backend to set this card as default
If card has NOT been attached, i need get card data from express checkout, pass it to backend, to create and attach this card. But i have not found way how to get selected credit card data from express checkout. So i creating payment method from frontend using stripe.createPaymentMethod(). Then i am getting pm id and passing it to backend, so backend attach this card.

I this case, you can use our Deferred Intent flow: https://docs.stripe.com/payments/accept-a-payment-deferred?platform=web&type=subscription and add custom logic to inspect the payment details. Then, you can decide if it is the same payment method or not using the fingerprint of the payment method.

However, this won't work for ApplePay or GooglePay as communicated earlier.

#

stripe.createPaymentMethod() not works without paymentMethodCreation: 'manual' setting
if paymentMethodCreation: 'manual' applied, then amazon pay button not renders
to solve issue with defining credit card already attached or not, we decided remove all gpay/apple pay cards, then create new one on each payment, to illuminate credit cards duplicates

Yes, this is expected. If you pass paymentMethodCreation: 'manual' Amazon Pay does not work. I tested this on my end as well to confirm.

pale gate
#

is it some limitation of amazon pay?

granite flax
#

That, I'm unsure to be honest and I would not know.

pale gate
#

backend needs attached pm id to create subscription. So i can't get credit card details from express checkout as you described above. So i need create payment method from frontend, to get pm id. But it works only with paymentMethodCreation: 'manual', where amazon pay not works. But we need it. What can you suggest?

granite flax
#

Can you review and try this please?

pale gate
#

one second

granite flax
#

Sure!

pale gate
#

i got this. As i understood you suggest use stripeInstance.elements(ElementsOptions).create('payment') instead of stripeInstance.elements(ElementsOptions).create('expressCheckout', eceOptions) ?

granite flax
#

You would want to use subscription likely as you were using that ealrier, but yes.

pale gate
#

ok, i will try it, thank you!

granite flax
#

Happy to help!

carmine rover
pale gate
#

i rendered it inside stripe accordion, just for testing

carmine rover
#

ok

granite flax
#

It looks like you're good here!

carmine rover
#

will check this on monday

#

if anything can i reopen this thread?

granite flax
#

I will need to close this thread, but on Monday, just have a summary of the issue and we will be able to jump in.

carmine rover
#

ok thanks!
have a great weekend