#Guillaume - afterpay
1 messages · Page 1 of 1 (latest)
ev.preventDefault();
hideError();
submitButton.value = "Processing...";
submitButton.disabled = true;
const {error} = await stripe.confirmPayment({
elements,
confirmParams: {
return_url: '$returnURL',
},
});
if (error) {
showError("Your payment could not be processed. " + error.message);
submitButton.value = "Submit Payment";
submitButton.disabled = false;
}
return false;
}```
It works with other methods I've tested so far (card payments and wechat)
the docs mention that a shipping address needs to be added to the PI for Afterpay, but I thought this wasn't needed if using 'automatic_payment_methods' => [ 'enabled' => 'true', ] , and that your code would pass the data collected from the form (otherwise what's the point of having the address fields pop up?)
Interesting. Thank you for the code, checking in to this...
Apologies for the long delay on this answer, I have recreated this but am having trouble figuring out the fix. Am consulting my colleagues and should have an answer soon
https://stripe.com/docs/payments/afterpay-clearpay/accept-a-payment?platform=web#web-create-payment-intent
Afterpay requires both shipping and billing details to be present for the payment to succeed. This integration guide suggests passing the shipping details on the server (step 2) and the billing details on the client after the customer selects their payment method (step 3).