Hi,
i am implementing the 'payment' element for paymentintent
with html, php & javascript
With the sample Stripe provides, i have the issue (well some would say it's expected) that, as soon the payment page is loaded, Stripe generates a payment intent with status ''Incomplete" .. then, when card details are entered and processed, a second payment intent is generated with (say) "Succeeded"
I start my code with
initialize();
then
// Fetches a payment intent and captures the client secret
async function initialize() {
const { clientSecret } = await fetch("../create.php", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ items }),
}).then((r) => r.json());
elements = stripe.elements({ clientSecret });
const paymentElement = elements.create("payment");
paymentElement.mount("#payment-element");
}
In order to avoid having an ''Incomplete" paymentintent generated i could either fetch the 1st generated paymentintent and then having it updated (on form submit)
... or have a seperate URL, to fetch the 1st paymentintent .. and so on
Do you have any recommendation for me?
I will provide the solution on a SaaS app, where clients can utilize the Stripe Gateway, to charge their clients.
It will be confusing for them to see these ''Incomplete" paymentintents on their payments page