#koks_api

1 messages ยท Page 1 of 1 (latest)

hidden gobletBOT
#

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

bitter whale
#

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);

}"

thorn breach
#

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

bitter whale
#

ok that is good to know

#

do you have js code to invode express checkout?

thorn breach
bitter whale
#

does this re-direct to stripe checkout screen. I assume no. Can you confirm?

thorn breach
#

Nope, it doesn't, it shows the payment request modal