Confirm Payment Source

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

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

  <html>
    <body>
      <form id="form">
        <label>
          <span>Intent Secret</span>
          <input id="secret" class="field" placeholder="" />
        </label>
        <div class="button-row">
          <button>Submit</button>
        </div>
      </form>

      <script src="https://js.stripe.com/v3/"></script>
      <script>
        // Retrieve Easyship stripe publishable api key through `GET /2023-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 /2023-01/payment_sources/confirm_3ds` here to finalize the payment source in Easyship
            }
          });
        });
      </script>
    </body>
  </html>

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

Required authorization scope: Payment Source

This API is currently in beta and is available upon request. Get in touch with your account manager or Easyship Support Team to enable it.

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