#asifarub_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/1349065402650460364
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi! You can disable all the payment methods you don't want: https://docs.stripe.com/js/elements_object/create_express_checkout_element#express_checkout_element_create-options-paymentMethods
There are errors in your console - you need to sort those out first.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Stripe Express Checkout</title>
<script src="https://js.stripe.com/v3/"></script>
</head>
<body>
<h1>Stripe Express Checkout</h1>
<div id="express-checkout-element"></div>
<script type="text/javascript">
const expressCheckoutElement = checkout.createElement('expressCheckout');
expressCheckoutElement.on('confirm', (event) => {
checkout.confirm({expressCheckoutConfirmEvent: event})
});
expressCheckoutElement.mount('#express-checkout-element');
</script>
</body>
</html>
this is all what i have in the code which i dont think is right
It's not. The code you want is here: https://docs.stripe.com/elements/express-checkout-element#create-an-express-checkout-element
ok great, let me try this out
thank you
another question, will this work with subscription price model?
What do you mean?
i was able to see the google pay
but 1) it is not the right product
- i have set up the product as recurring pay, which i dont see when I open the payment
You didn't tell it anything about using a recurring product.
const elements = stripe.elements({
mode: 'payment',
amount: 1099,
currency: 'usd',
appearance,
})
const expressCheckoutElement = elements.create('expressCheckout', options)
expressCheckoutElement.mount('#express-checkout-element')
we have to manually specify this. Is there any wayto pick it up from stripe product page automatically
fyi i'm taking over for timebox, caching up now. the discord is a little busy so it might take me a bit to respond.
no worries
I am trying to set up recurring payment using expressCheckout
https://docs.stripe.com/js/elements_object/create_express_checkout_element <- document is not very clear how to set up recurring payment
you basically want to
- create a subscription on your backend
- get the subscription.latest_invoice.payment_intent.client_secret and pass that to your frontend
- create the express element using the client secret from step 2
basically follow this guide but use the express element instead of payment
https://docs.stripe.com/billing/subscriptions/build-subscriptions?platform=web&ui=elements
let me sanity check something real quick
sure
yeah you should be able to follow that guide i linked earlier and then when you get to step 5, just add the express element in place of the payment element
have you tried that yet?
that will require some backend integration. will need some time
what i tried is this
const elements = stripe.elements({
mode: 'subscription',
amount: 199,
currency: 'usd',
setupFutureUsage : 'on_session',
appearance,
})
const expressCheckoutElement = elements.create('expressCheckout', options)
expressCheckoutElement.mount('#express-checkout-element')
according to the doc, i can set mode but it didn't work
sorry my integration was having issues so i wasn't able to test things but i just got it working again
but yeah no matter what route you go at some point you're going to need to create a subscription from the backend
aaand i was just able to set up what you want. so yes, the recommended approach for this is to follow that guide, but just swap the payment element out for express element in step 5.
ok thank you
yep! feel free to give that a shot and if you have any issues you're welcome to come back for more support ๐