<!-- canonical: https://docs.costplus.io/docs/guides/recurring-payments -->

> Set up merchant-initiated recurring payments and subscriptions
Recurring payments allow you to charge customers on a schedule without their active participation. This is a **Merchant Initiated Transaction (MIT)** flow.

## How It Works

The recurring flow has two phases:

1. **First payment** — The customer authenticates and pays, granting permission for future charges
2. **Subsequent payments** — You charge the customer's stored card without their interaction

## Phase 1: First Payment

Create an order with `recurring_type: "first"` and a `schedule_type`:

```json title="POST /v1/orders/"
{
  "merchant_order_id": "first-recurring",
  "currency": "EUR",
  "amount": 1295,
  "return_url": "https://www.example.com",
  "transactions": [
    {
      "payment_method": "credit-card",
      "recurring_type": "first",
      "schedule_type": "scheduled"
    }
  ]
}
```

### Schedule Types

| Type | Description |
|------|-------------|
| `scheduled` | Fixed schedule (e.g., monthly subscription) |
| `unscheduled` | Variable timing (e.g., top-up when balance is low) |

After successful payment, store the `vault_token` and/or `first_transaction_id` from the response.

## Phase 2: Subsequent Recurring Payment

Charge the customer using the stored token:

```json title="POST /v1/orders/"
{
  "merchant_order_id": "recurring-order",
  "currency": "EUR",
  "amount": 995,
  "transactions": [
    {
      "payment_method": "credit-card",
      "recurring_type": "recurring",
      "vault_token": "{vault_token}"
    }
  ]
}
```

> [!NOTE]
> Recurring payments do **not** return a `payment_url` in the response since no customer interaction is needed. The payment is processed immediately.

> [!TIP]
> You can use either `vault_token` or `first_transaction_id` to reference the stored card.

## Token Validity

Recurring tokens have a **maximum validity of 1 year**. After expiry, you must initiate a new first payment to obtain a fresh token.

> [!WARNING]
> Make sure your system handles token expiry gracefully. Set up a process to re-authenticate customers before their tokens expire.

## Recurring vs One-Click

| Feature | Recurring (MIT) | One-Click (CIT) |
|---------|----------------|-----------------|
| Initiated by | Merchant | Customer |
| Customer present | No | Yes |
| Use case | Subscriptions, scheduled billing | Fast checkout for returning customers |
| `schedule_type` required | Yes | No |
| `payment_url` returned | No | Yes |

## Related Endpoints

- [Create Order](/api-reference/orders/createOrder) — use `recurring_type` and `schedule_type` in the transaction to set up or charge recurring payments
