#dsgvsaf
1 messages · Page 1 of 1 (latest)
hello! do you have a URL to your site which i can access to take a look?
一音符咖啡
in Chinese
test1
123456
This is a test account
After logging in, access this
gimme a while to get back to you
OK
Hi @gritty pollen I'm Jack and I'm an engineer from Stripe. How do you mount the Payment Request button?
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});
});
Thanks. Are you embedding the payment request button in another iframe?
No
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.
The Apple Pay button is showing up in safari
wait a minute
Didn't error?
Because I'm chrome
I should check if the environment is available for Apple Pay, right?
Apple Pay doesn't work in Chrome.