#koks_api
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/1389604718808006667
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Here is the sample JS code "async initializeApplePay() {
console.log('entered apple pay section');
const paymentRequest = await this.stripe.paymentRequest({
country: 'US',
currency: 'usd',
total: {
label: 'Demo Product',
amount: 1999,
},
requestPayerName: true,
requestPayerEmail: true,
});
const elements = this.stripe.elements();
const prButton = elements.create('paymentRequestButton', {
paymentRequest: paymentRequest,
});
setTimeout(() => {
paymentRequest.canMakePayment().then((result) => {
console.log(JSON.stringify(result), '**', result.applePay);
if (result && result.applePay) {
prButton.mount(this.template.querySelector('.payment-request-button'));
} else {
this.template.querySelector('.payment-request-button').style.display = 'none';
}
});
paymentRequest.on('paymentmethod', async (ev) => {
// Handle payment confirmation with your backend here
ev.complete('success');
alert('Payment completed (demo).');
});
}, 1500);
}"
Hi ๐ can you elaborate on what you mean when you say "it is not working"?
Also, sounds like you're working on implementing the Payment Request Button, which is a bit legacy at this point. I'd suggest considering the newer Express Checkout Element instead, unless you have a restrictoin that requires the use of the Payment Request Button instead.
https://docs.stripe.com/elements/express-checkout-element
We did ... but I'm not sure where it went. This is the closest thing I'm seeing right now:
https://docs.stripe.com/elements/express-checkout-element/migration
I'm trying to see if we just moved the better version of the guide.
does this re-direct to stripe checkout screen. I assume no. Can you confirm?
Nope, it doesn't, it shows the payment request modal