---
description: >-
  This guide provides a simplified overview of how to implement subscription
  payments using our Card On File API.
---

# Subscriptions with Card On File

### Overview

Our Card On File API lets you securely store customer payment information and charge recurring payments without handling sensitive card data after the initial tokenization.

### Implementation Steps

#### Step 1: Store the Customer's Card

1. Collect the customer's card information securely via your PCI-compliant form
2. Call our Card On File API to store the card
3. Receive a `card_identifier` token that represents the stored card

```json
POST https://cc-api-stg.directa24.com/v3/tokenization
```

#### Step 2: Create a Subscription

1. Associate the `card_identifier` with your internal subscription record
2. Generate a unique `external_subscription_id` in your system
3. Store both identifiers for future transactions

#### Step 3: Process Recurring Charges

When it's time to charge the customer:

1. Call our PCI Compliant deposit endpoint
2. Instead of sending full card details, send:
   * The **`card_identifier`** token
   * Your **`external_subscription_id`**

```json
POST https://cc-api-stg.directa24.com/v3/deposits
```

Example request:

<pre class="language-json" data-overflow="wrap"><code class="lang-json">{
    "invoice_id": "800000001",
    "amount": 1000,
    "country": "BR",
    "currency": "BRL",
    "payer": {
        "id": "11111",
        "document": "84932568207",
        "document_type": "CPF",
        "email": "johnSmith12@hotmail.com",
        "first_name": "John",
        "last_name": "Smith",
        "phone": "+233852662222",
        "birth_date": "19880910",
        "address": {
            "street": "Calle 13",
            "city": "bahia",
            "state": "SP",
            "zip_code": "12345-678"
        }
    },
<strong>    "card_identifier": "CID-2210908e-6d8e-468d-9eb3-d551e8b541a0",
</strong><strong>    "external_subscription_id": "ABC1234",
</strong>    "client_ip": "123.123.123.123",
    "device_id": "knakvuejffkiebyab",
    "fee_on_payer": false
}
</code></pre>

#### Step 4: Handle Subscription Lifecycle

Remember to implement logic for:

* Subscription renewals
* Failed payments and retries
* Subscription cancellations
* Card updates and replacements



### Next Steps

* See our detailed [Card On File API](../api-documentation/card-on-file-api) Reference for complete implementation details
* Review our [PCI Deposits Endpoint](../api-documentation/deposits-api/endpoints/pci-deposit-creation-endpoint) Documentation for all available parameters
