We are currently working on a new feature that allows you to manage payment methods on your own payment page without any business-code. This feature is called Fynn elements and will be available in Q2.24.
After creating the SetupIntent, you can show the Stripe.js card element in your form to collect the card details.
Then confirm the SetupIntent with the card details.
<html><head><scriptsrc="https://js.stripe.com/v3/"></script><script> var stripe = Stripe('pk_test_1234567890:<publishableKey>', { // previously received from the response stripeAccount: 'acct_1234567890:<accountId>' // previously received from the response }); // see: https://docs.stripe.com/js/element/other_element?type=card var elements = stripe.elements(); var card = elements.create('card'); card.mount('#card-element'); var paymentIntentClientSecret = '<clientSecret>'; // previously received from the response var form = document.getElementById('payment-form'); form.addEventListener('submit', function(event) { event.preventDefault(); stripe.confirmCardSetup(paymentIntentClientSecret, { payment_method: { card: card, billing_details: { name: 'Jenny Rosen' } } }).then(function(result) { if (result.error) { console.log(result.error.message); } else { console.log(result.setupIntent.payment_method); // send payment method id to fynn // see: https://docs.fynn.app/api-reference/paymentmethod/create-payment-method } }); });</script></head><body><formid="payment-form"><divid="card-element"></div><buttonid="submit">Submit</button></form></body></html>
3
Assign payment method
Assign the payment method created in stripe with Fynn. Use the payment method id received from the confirmation result.setupIntent.payment_method.