Confirm Payment Source

Easyship integrate with Stripe Setup Intent to collect credit card and bank account information.
Ref: https://docs.stripe.com/payments/save-and-reuse-cards-only

Here's a example of how you can process 3DS for card setup intent on the client side. Once the validation is completed, you can use the setup_intent.id to finalize the payment source in Easyship.

Confirm 3DS Example ```html Intent Secret
Submit
    <script src="https://js.stripe.com/v3/"></script>
    <script>
      // Retrieve Easyship stripe publishable api key through `GET /2024-01/account/stripe`
      var stripe = Stripe('Easyship_stripe_publishable_api_key');

      // Handle form submission and trigger 3DS
      var form = document.getElementById('form');
      form.addEventListener('submit', function (event) {
        event.preventDefault();

        var secret = document.getElementById('secret').value;
        console.log(secret)

        stripe.confirmCardSetup(secret).then(function (result) {
          if (result.error) {
            // error handling
          } else {
            // You would receive the `setup intent id` with prefix `seti_`.
            // `POST /2024-01/payment_sources/confirm` here to finalize the payment source in Easyship
          }
        });
      });
    </script>
  </body>
</html>
</details>

Should the setup intent not have undergone 3D Secure, you'll receive a status code 202, indicating the need to process 3D Secure.

If the setup intent is for us bank account. You'll receive a status code 202, indicating the need to do micro deposit verification. The verification url will be provided in the response and the verification code will be sent to the email address attached to the bank account.

Reference: https://docs.stripe.com/payments/ach-debit/set-up-payment?platform=web&payment-ui=direct-api#optional:-send-custom-email-notifications

Once the verification is completed, stripe webhook would mark your bank account payment source activated.

Required authorization scope: `public.payment_source:write`


Language
Authorization
Bearer
token
Click Try It! to start a request and see the response here!