Subscriptions with Card On File

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

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

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

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

Example request:

{
    "invoice_id": "800000001",
    "amount": 1000,
    "country": "BR",
    "currency": "BRL",
    "payer": {
        "id": "11111",
        "document": "84932568207",
        "document_type": "CPF",
        "email": "[email protected]",
        "first_name": "John",
        "last_name": "Smith",
        "phone": "+233852662222",
        "birth_date": "19880910",
        "address": {
            "street": "Calle 13",
            "city": "bahia",
            "state": "SP",
            "zip_code": "12345-678"
        }
    },
    "card_identifier": "CID-2210908e-6d8e-468d-9eb3-d551e8b541a0",
    "external_subscription_id": "ABC1234",
    "client_ip": "123.123.123.123",
    "device_id": "knakvuejffkiebyab",
    "fee_on_payer": false
}

Step 4: Handle Subscription Lifecycle

Remember to implement logic for:

  • Subscription renewals

  • Failed payments and retries

  • Subscription cancellations

  • Card updates and replacements

Next Steps

Last updated

Was this helpful?