aGandrass's avatar

Stripe Payment Intent | Manual Confirmation

Hi, does anybody have experience in coding the new Stripe Payment Intent Manual Confirmation? I am trying for a couple of weeks but I am unable to find the right way. Thank you very much https://stripe.com/docs/payments/payment-intents/quickstart#

Update: I have followed every Step of the process but one part I do not know how to go ahead. In my client check out page I have put the following code into. The next step would be to charge the card with the PaymentMethodID on my server. I do not understand how this code snippets sends the PaymentMethod ID to my server. What does fetch('/ajax/confirm_payment') mean? Don´t I have to put the location where I actually charge the card?

Thank you again

var cardholderName = document.getElementById('cardholder-name'); var cardButton = document.getElementById('card-button');

cardButton.addEventListener('click', function(ev) { stripe.createPaymentMethod('card', cardElement, { billing_details: {name: cardholderName.value} }).then(function(result) { if (result.error) { // Show error in payment form } else { // Otherwise send paymentMethod.id to your server (see Step 2) fetch('/ajax/confirm_payment', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ payment_method_id: result.paymentMethod.id }) }).then(function(result) { // Handle server response (see Step 3) result.json().then(function(json) { handleServerResponse(json); }) }); } }); });

0 likes
1 reply
aGandrass's avatar

Finally I have found the solution. It wasn´t necessary confirming manually. Automatic confirmation works best.

Please or to participate in this conversation.