#salim-bt_docs
1 messages ยท Page 1 of 1 (latest)
๐ 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.
- salim-bt_docs, 1 hour ago, 14 messages
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'?
Hello! No, I don't believe that approach is supported, but let me confirm...
ok thank you!
waiting
Doesn't seem to be supported. Can you tell me what you're trying to build?
we has subscription system, and i am using express chekout element
does amazon supported in subscription?
if amazon supported with paymentMethodCreation: 'manual'
Amazon Pay supports Subscriptions, yes, but I don't think Subscriptions require paymentMethodCreation to be set to manual.
well can you confirm
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?
Express Checkout Element
with manual?
wait , i using expressCheckout and stripe.createPaymentMethod()
No, I mean if you remove paymentMethodCreation: 'manual' does Amazon Pay show up?
yes
Amazon Pay + Express Checkout Element without paymentMethodCreation: 'manual' should work just fine to create a Subscription.
ok thank you so much
Happy to help!
Why?
Why are you using createPaymentMethod?
sec
Most integrations do not need or use createPaymentMethod, which is why I'm asking.
Normally you would run stripe.confirmPayment which would confirm the payment client-side and create the Payment Method all in a single step.
See the note here: https://docs.stripe.com/js/payment_methods/create_payment_method_elements
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
For a Subscription you shouldn't be creating a Payment Intent directly.
frontend only attach cards
Try following this guide: https://docs.stripe.com/payments/accept-a-payment-deferred?platform=web&type=subscription
And then add Express Checkout Element to that once you're done.
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?
๐ stepping in for my colleague here
?
@pale gate looks like you're in the wrong place, this thread is for someone else's question.
- If you have your own thread please chat there.
- If you have a question or a followup to a closed thread use one of the buttons in https://discord.com/channels/841573134531821608/842637025524842496 to get help (we don't reopen closed threads).
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.
inside elements.create('expressCheckout', eceOptions).on('confirm') event
NO, he is my Developer.
Ah, alright, thanks for clarifying
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
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?
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
Testing currently, will follow up shortly
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
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.
is it some limitation of amazon pay?
That, I'm unsure to be honest and I would not know.
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?
You can use this flow: https://docs.stripe.com/payments/accept-a-payment-deferred?platform=web&type=subscription to collect the payment method first, then create the subscription. At this point, you would have the payment method id
Can you review and try this please?
one second
Sure!
i got this. As i understood you suggest use stripeInstance.elements(ElementsOptions).create('payment') instead of stripeInstance.elements(ElementsOptions).create('expressCheckout', eceOptions) ?
You would want to use subscription likely as you were using that ealrier, but yes.
ok, i will try it, thank you!
Happy to help!
@granite flax can remove amazon from here? because we have it in separated accordion
i rendered it inside stripe accordion, just for testing
ok
It looks like you're good here!
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.
ok thanks!
have a great weekend