---
name: recurring
description: >-
  Guides through recurring card payments via Smart Glocal API: getting user
  consent, obtaining a token via first payment, then making Merchant-Initiated
  (MIT) or Customer-Initiated (CIT) recurring payments using that token, and
  managing tokens.
---

# Recurring Payments (CIT / MIT)

## Purpose

Use this skill to set up recurring card payments — obtaining a token via the first payment, then charging the buyer again using Customer-Initiated (CIT) or Merchant-Initiated (MIT) transactions.

## Primary references

- [Getting a token](https://developer.smart-glocal.com/payments/payment-recurring)
- [MIT recurring payments](https://developer.smart-glocal.com/payments/payment-recurringMIT)
- [CIT recurring payments](https://developer.smart-glocal.com/payments/payment-recurringCIT)
- [Token management](https://developer.smart-glocal.com/reference/methods/token-info)

## Preconditions

- [ ] One-time payment flow understood (see [one-time-payment](https://developer.smart-glocal.com/assets/skills/one-time-payment/SKILL.md))
- [ ] Buyer consent obtained for recurring charges
- [ ] Token obtained via first payment with `recurrent: true`

---

There are two types of recurring payments:

- **CIT (Customer Initiated Transaction)** — with buyer involvement, requires 3DS
- **MIT (Merchant Initiated Transaction)** — without buyer involvement, no 3DS

Both types require the same preliminary step — obtaining a token.

## Stage 0: Getting a Token

### 0.1. Obtain Buyer Consent

You must obtain explicit user consent for recurring charges. For example:

- A checkbox labeled "Save card" / "Enable auto-payment" on your side
- A checkbox in the Smart Glocal payment widget

### 0.2. First Payment with recurrent Flag

Make a regular [one-time payment](https://developer.smart-glocal.com/assets/skills/one-time-payment/SKILL.md) with `"recurrent": true` in `payment_options`:

```bash
curl -X POST https://demo.smart-glocal.com/api/v2/session/create \
  -H "Content-Type: application/json" \
  -H "X-PARTNER-PROJECT: shop1" \
  -H "X-PARTNER-SIGN: <signature>" \
  -d '{
    "amount_details": {
      "amount": 10000,
      "currency": "usd"
    },
    "payment_details": {
      "type": "card"
    },
    "customer": {
      "reference": "user_123"
    },
    "payment_options": {
      "recurrent": true
    }
  }'
```

Complete the full payment flow (start/payment → confirm → finish).

### 0.3. Receive the Token

The `payment_finished` webhook returns a `recurrent` object with the token:

```json
{
  "event": "payment_finished",
  "session_id": "ps_xxx",
  "recurrent": {
    "token": "a1b2c3d4e5f6...",
    "created_at": "2026-07-06T12:00:00Z",
    "is_active": true,
    "type": "recurrent_token"
  }
}
```

Save `recurrent.token` — it is required for all subsequent recurring payments.

---

## MIT — Merchant Initiated Transaction

Charge without buyer involvement. Suitable for subscriptions, memberships, monthly bills.

### Flow

```
session/create → session/start/payment (with token)
  → ready_to_confirm → session/confirm → payment_finished
```

### 1. Create a Session

```bash
curl -X POST https://demo.smart-glocal.com/api/v2/session/create \
  -H "Content-Type: application/json" \
  -H "X-PARTNER-PROJECT: shop1" \
  -H "X-PARTNER-SIGN: <signature>" \
  -d '{
    "amount_details": {
      "amount": 5000,
      "currency": "usd"
    },
    "customer": {
      "reference": "user_123"
    }
  }'
```

### 2. Start Payment with recurrent Type

```bash
curl -X POST https://demo.smart-glocal.com/api/v2/session/start/payment \
  -H "Content-Type: application/json" \
  -H "X-PARTNER-PROJECT: shop1" \
  -H "X-PARTNER-SIGN: <signature>" \
  -d '{
    "session_id": "ps_xxx",
    "payment_details": {
      "type": "recurrent",
      "recurrent": {
        "token": "a1b2c3d4e5f6...",
        "initiator": "merchant"
      }
    },
    "amount_details": {
      "amount": 5000,
      "currency": "usd"
    },
    "customer": {
      "reference": "user_123"
    }
  }'
```

Key fields:
- `payment_details.type: "recurrent"` — marks the payment as recurring
- `payment_details.recurrent.token` — the token from stage 0
- `payment_details.recurrent.initiator: "merchant"` — merchant initiated (MIT)

### 3. Confirm

Wait for `ready_to_confirm` → call `session/confirm`.

### 4. Result

`payment_finished` webhook with status `succeeded`.

> **Important:** MIT does not require 3DS — the charge happens without the buyer.

---

## CIT — Customer Initiated Transaction

Charge with buyer involvement via 3DS. Suitable when the buyer initiates a repeat payment themselves (e.g., same card for a new order).

### Flow

```
session/create → session/start/payment (with token, initiator: client)
  → ready_to_confirm → session/confirm
  → action_required → 3DS redirect → payment_finished
```

### 1. Create a Session

Same as MIT.

### 2. Start Payment with initiator: client

```bash
curl -X POST https://demo.smart-glocal.com/api/v2/session/start/payment \
  -H "Content-Type: application/json" \
  -H "X-PARTNER-PROJECT: shop1" \
  -H "X-PARTNER-SIGN: <signature>" \
  -d '{
    "session_id": "ps_xxx",
    "payment_details": {
      "type": "recurrent",
      "recurrent": {
        "token": "a1b2c3d4e5f6...",
        "initiator": "client"
      }
    },
    "amount_details": {
      "amount": 5000,
      "currency": "usd"
    },
    "customer": {
      "reference": "user_123"
    },
    "payment_options": {
      "return_url": "https://your-site.com/payment/result"
    }
  }'
```

Differences from MIT:
- `initiator: "client"` — buyer initiated
- `payment_options.return_url` — URL to redirect the buyer after 3DS

### 3. Confirm

Wait for `ready_to_confirm` → `session/confirm`.

### 4. 3D Secure

After confirm, the `action_required` webhook arrives with the 3DS redirect URL:

```json
{
  "event": "action_required",
  "session_id": "ps_xxx",
  "customer_interaction": {
    "type": "redirect",
    "redirect": {
      "url": "https://acs-bank.com/3ds?token=...",
      "method": "GET"
    }
  }
}
```

Redirect the buyer to `redirect.url`. After authentication, they return to your `return_url`.

### 5. Result

`payment_finished` webhook with status `succeeded`.

---

## Token Management

### Check Token Status

```bash
curl -X POST https://demo.smart-glocal.com/api/v2/token/info \
  -H "Content-Type: application/json" \
  -H "X-PARTNER-PROJECT: shop1" \
  -H "X-PARTNER-SIGN: <signature>" \
  -d '{
    "type": "recurrent_token",
    "recurrent_token": {
      "token": "a1b2c3d4e5f6..."
    }
  }'
```

The response shows `is_active` (active or not) and `finished_at` (expiry date).

### Disable a Token

If a buyer disables auto-payments:

```bash
curl -X POST https://demo.smart-glocal.com/api/v2/recurrent/disable \
  -H "Content-Type: application/json" \
  -H "X-PARTNER-PROJECT: shop1" \
  -H "X-PARTNER-SIGN: <signature>" \
  -d '{
    "token": "a1b2c3d4e5f6..."
  }'
```

After disabling, `is_active` becomes `false` — payments with this token will be rejected.

---

## MIT vs CIT Summary

| | MIT | CIT |
|---|---|---|
| Buyer involvement | No | Yes (3DS) |
| `initiator` | `merchant` | `client` |
| `return_url` | Not needed | Required |
| 3DS | No | Yes |
| Use case | Subscriptions, memberships | Repeat purchases with same card |
