# Create a test Confirmation Token

Creates a test mode Confirmation Token server side for your integration tests.

## Request

```curl
curl https://api.stripe.com/v1/test_helpers/confirmation_tokens \
  -u "<<YOUR_SECRET_KEY>>" \
  -d payment_method=pm_card_visa
```

### Response

```json
{
  "id": "ctoken_1Ow71CL4FhS6zgoxWjxc7sfr",
  "object": "confirmation_token",
  "created": 1710871450,
  "expires_at": 1710914650,
  "livemode": false,
  "payment_intent": null,
  "payment_method_preview": {
    "billing_details": {
      "address": {
        "city": null,
        "country": null,
        "line1": null,
        "line2": null,
        "postal_code": null,
        "state": null
      },
      "email": null,
      "name": null,
      "phone": null
    },
    "card": {
      "brand": "visa",
      "checks": {
        "address_line1_check": null,
        "address_postal_code_check": null,
        "cvc_check": "unchecked"
      },
      "country": "US",
      "display_brand": "visa",
      "exp_month": 3,
      "exp_year": 2025,
      "fingerprint": "jbGyCKrSRsFpOBWP",
      "funding": "credit",
      "generated_from": null,
      "last4": "4242",
      "networks": {
        "available": [
          "visa"
        ],
        "preferred": null
      },
      "three_d_secure_usage": {
        "supported": true
      },
      "wallet": null
    },
    "type": "card"
  },
  "return_url": null,
  "setup_future_usage": null,
  "setup_intent": null,
  "shipping": null,
  "use_stripe_sdk": true
}
```

## Returns

Returns a testmode Confirmation Token

## Parameters

- `payment_method` (string, optional)
  ID of an existing PaymentMethod.

- [`payment_method_data`](https://docs.stripe.com/api/confirmation_tokens/test_create.md?query=payment_method_data) (object, optional)
  If provided, this hash will be used to create a PaymentMethod.

- [`payment_method_options`](https://docs.stripe.com/api/confirmation_tokens/test_create.md?query=payment_method_options) (object, optional)
  Payment-method-specific configuration for this ConfirmationToken.

- `return_url` (string, optional)
  Return URL used to confirm the Intent.

- `setup_future_usage` (enum, optional)
  Indicates that you intend to make future payments with this ConfirmationToken’s payment method.

  The presence of this property will [attach the payment method](https://docs.stripe.com/payments/save-during-payment.md) to the PaymentIntent’s Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete.
Possible enum values:
  - `off_session`
    Use `off_session` if your customer may or may not be present in your checkout flow.

  - `on_session`
    Use `on_session` if you intend to only reuse the payment method when your customer is present in your checkout flow.

- [`shipping`](https://docs.stripe.com/api/confirmation_tokens/test_create.md?query=shipping) (object, optional)
  Shipping information for this ConfirmationToken.
