Starts the payment flow for the vaulted payment method. You can get the id from any instance of VaultedPaymentMethod returned by fetchVaultedPaymentMethods.

Upon a successful invocation of this function, the SDK will automatically trigger the standard payment callbacks.

Without additional data

TYPESCRIPT
    async startPaymentFlow(vaultedPaymentMethodId: string): Promise<void>

Parameters

With additional data

In certain cases, you can pass additionalData when starting a payment flow. For example, you might need to pass CVV which can be recommended to increase auth rates.

Make sure that additionalData is validated before being passed to this method.

TYPESCRIPT
    async startPaymentFlow(vaultedPaymentMethodId: string, additionalData: VaultedPaymentMethodAdditionalData)

Parameters

Returns

The startPaymentFlow method initiates the payment process using the provided vaultedPaymentMethodId. This method is responsible for beginning the payment flow associated with a specific payment method stored in the vault. Returns a Promise of void.

Example

Refer to the following example for fetching vaulted payment methods.

The VaultManager needs to be configured before validate can be called. Refer to the following example for configuring the VaultManager.

Without additional data

TYPESCRIPT
async function startpaymentFlow() {
  try {
    //Ensure the Vault Manager has been configured
    await vaultManager.startPaymentFlow("yourVaultedPaymentMethodId");
    console.log("Payment flow started successfully");
  } catch (error) {
    console.error("Error starting payment flow:", error);
  }
}

With additional data

Refer to the following example for validation of the vaulted payment method additional data.

TYPESCRIPT
async function startpaymentFlow() {
  try {
    //Ensure the Vault Manager has been configured
    await vaultManager.startPaymentFlow(
      "yourVaultedPaymentMethodId",
      yourAdditionalData
    );
    console.log("Payment flow started successfully");
  } catch (error) {
    console.error("Error starting payment flow:", error);
  }
}