#dsgvsaf

1 messages · Page 1 of 1 (latest)

stuck ridgeBOT
visual lava
#

hello! do you have a URL to your site which i can access to take a look?

gritty pollen
#

in Chinese

#

test1
123456

#

This is a test account

#

After logging in, access this

visual lava
#

gimme a while to get back to you

gritty pollen
#

OK

valid juniper
#

Hi @gritty pollen I'm Jack and I'm an engineer from Stripe. How do you mount the Payment Request button?

gritty pollen
#

var stripe = Stripe("{$api_public_key}",{apiVersion: "2022-11-15"});
var paymentRequest = stripe.paymentRequest({
country: 'HK',
currency: 'hkd',
total: {
label: '訂單結賬',
amount: Number(order_amount),
},
requestPayerName: true,
requestPayerEmail: true,
});
var elements = stripe.elements();
const prButton = elements.create('paymentRequestButton', {
paymentRequest,
});
(async () => {
const result = await paymentRequest.canMakePayment();
if (result) {
prButton.mount('#payment-request-button');
} else {
document.getElementById('payment-request-button').style.display = 'none';
}
})();
paymentRequest.on('paymentmethod', async (e) => {
alert(Client secret returned.);
let {error, paymentIntent} = await stripe.confirmCardPayment(
clientSecret,
{payment_method: e.paymentMethod.id,},
{handleActions: false,}
);
if (error) {
console.log(error.message);
e.complete('fail');
return;
}
e.complete('success');
if (paymentIntent.status === 'requires_action') {
let {error, paymentIntent} = await stripe.confirmCardPayment(clientSecret);
if (error) {
console.log(error.message);
return;
}
console.log(Payment ${paymentIntent.status}: ${paymentIntent.id});
}
console.log(Payment ${paymentIntent.status}: ${paymentIntent.id});
});

valid juniper
#

Thanks. Are you embedding the payment request button in another iframe?

gritty pollen
#

No

valid juniper
#

Did you update the code? I don't see the Apple Pay button on your page anymore.

#

Also I don't see that error in Safari's browser console.

gritty pollen
#

now?

valid juniper
#

The Apple Pay button is showing up in safari

gritty pollen
#

wait a minute

#

Didn't error?

#

Because I'm chrome

#

I should check if the environment is available for Apple Pay, right?

valid juniper
#

Apple Pay doesn't work in Chrome.