Open Affirm Virtual Card Checkout

Use affirm.checkout.open_vcn() to open Affirm Checkout in a modal for your customers, an Affirm-hosted page to securely complete the loan checkout. When the customer completes their purchase, you'll need to handle the callbacks.

affirm.checkout.open_vcn(checkout_data)

Method arguments


MethodData typeDescription
checkout_data
required
objectSee details.

Returns

Returns callbacks that resolve in a card_checkout, error_response or checkout_validation_error. Those objects have either:

  • card_checkout: A card object was successfully created.
  • error_response: There was an error. Includes the checkout_id for the attempt and the reason why it failed.
  • checkout_validation_error: There was a validation error with the checkout request submitted.
affirm.checkout.open_vcn({
      success: function(card_checkout) {
         console.log(card_checkout);
      },
      error: function(error_response) {
        console.log(error_response);
      },
      onValidationError: function(checkout_validation_error) {
      console.log(checkout_validation_error)
    }
 });

🚧

You can configure that the card details should only be returned on the server-side. Please contact Affirm.