#Deviser
1 messages · Page 1 of 1 (latest)
If you're in test mode, we don't send test receipts: https://stripe.com/docs/receipts#:~:text=Test payments created using your test API keys don’t automatically send receipts. Instead%2C you can view or manually send a receipt using the Dashboard.
I am using the live code.
Not according to this screenshot: https://prnt.sc/n03OjAG2kaya
Sure!
But the point is if i am using the live code from the snippet. I am not able to pass the customer email into the above script.
Depends what you mean by 'pass the customer email'?
So, share any example then if you have any.
I'm trying to understand what it is you're trying doing
You said 'pass the customer email', but what does that mean
giving the example
<!-- Load Stripe.js on your website. -->
<script src="https://js.stripe.com/v3"></script>
<!-- Create a button that your customers click to complete their purchase. Customize the styling to suit your branding. -->
<button
style="background-color:#6772E5;color:#FFF;padding:8px 12px;border:0;border-radius:4px;font-size:1em;cursor:pointer"
id="checkout-button-price_1MwJ9ZSG6SKUi8yprXonvard"
role="link"
type="button"
Checkout
</button>
<div id="error-message"></div>
<script>
(function() {
var stripe = Stripe('pk_test_51L3Jb7SG6SKUi8ypMzeGlFRwVmW4KD2SwUFrOILAREIuTLpfs5Go4eKhlg9WTN3lkJvMZwCeg5M4lf7pOuqvEApi00V7fLyGNt');
var checkoutButton = document.getElementById('checkout-button-price_1MwJ9ZSG6SKUi8yprXonvard');
checkoutButton.addEventListener('click', function () {
/*
* When the customer clicks on the button, redirect
* them to Checkout.
/
stripe.redirectToCheckout({
customer_email: 'a.b@gmail.com',
lineItems: [{price: 'price_1MwJ9ZSG6SKUi8yprXonvard', quantity: 1}],
mode: 'payment',
/
* Do not rely on the redirect to the successUrl for fulfilling
* purchases, customers may not always reach the success_url after
* a successful payment.
* Instead use one of the strategies described in
* https://stripe.com/docs/payments/checkout/fulfill-orders
/
successUrl: 'https://example.com/success',
cancelUrl: 'https://example.com/canceled',
})
.then(function (result) {
if (result.error) {
/
* If redirectToCheckout fails due to a browser or network
* error, display the localized error message to your customer.
*/
var displayError = document.getElementById('error-message');
displayError.textContent = result.error.message;
}
});
});
})();
</script>
here i added the customer email
but it's not working
It's customerEmail: https://stripe.com/docs/js/deprecated/redirect_to_checkout
the purpose of the above code is
when we click on button . it's redirect to checkout page of the stripe.
But the email field of the checkout page is showing empty. I need that email field will auto filled by passing the passing any email from the code
thanks! I am trying the above parameter
Thanks @zealous siren
It's working
Thank you
Perfect