> ## Documentation Index
> Fetch the complete documentation index at: https://primer.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# startPaymentFlow

Starts the payment flow for the vaulted payment method. You can get the `id` from any instance of `VaultedPaymentMethod`
returned by [fetchVaultedPaymentMethods](/docs/sdk/react-native/v2.x.x/primer-headless-checkout/vault-manager/fetchVaultedPaymentMethods).

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

## Without additional data

```typescript TYPESCRIPT theme={"dark"}
    async startPaymentFlow(vaultedPaymentMethodId: string): Promise<void>
```

### Parameters

<Expandable title="Parameters" defaultOpen>
  <ResponseField name="vaultedPaymentMethodId" type="String" required>
    The `id` of `VaultedPaymentMethod` previously retrieved with [fetchVaultedPaymentMethods](/docs/sdk/react-native/v2.x.x/primer-headless-checkout/vault-manager/fetchVaultedPaymentMethods).
  </ResponseField>
</Expandable>

## 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](/docs/sdk/react-native/v2.x.x/primer-headless-checkout/vault-manager/validate) before being passed to this method.

```typescript TYPESCRIPT theme={"dark"}
    async startPaymentFlow(vaultedPaymentMethodId: string, additionalData: VaultedPaymentMethodAdditionalData)
```

### Parameters

<Expandable title="Parameters" defaultOpen>
  <ResponseField name="additionalData" type="VaultedPaymentMethodAdditionalData" required>
    <Expandable title="Properties" defaultOpen>
      <ResponseField name="cvv" type="string" required>
        CVV value associated with the vaulted card.
      </ResponseField>
    </Expandable>
  </ResponseField>
</Expandable>

## 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](/docs/sdk/react-native/v2.x.x/primer-headless-checkout/vault-manager/fetchVaultedPaymentMethods#example) vaulted payment methods.

The `VaultManager` needs to be configured before `validate` can be called.
Refer to the following example for [configuring](/docs/sdk/react-native/v2.x.x/primer-headless-checkout/vault-manager/configure) the `VaultManager`.

### Without additional data

```typescript TYPESCRIPT theme={"dark"}
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](/docs/sdk/react-native/v2.x.x/primer-headless-checkout/vault-manager/validate)
of the vaulted payment method additional data.

```typescript TYPESCRIPT theme={"dark"}
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);
  }
}
```
