Lifecycle status & Workflows

Understanding the Direct Debit lifecycle is essential for managing automated payments effectively. This page details the various states a debit can inhabit and the automated workflows—from creation to final completion—that drive the payment engine.

Direct Debit Lifecycle Status

Each Direct Debit follows a strict state machine to ensure security and billing accuracy.

StatusDescriptionPermitted Next States
createdInitial state; the Direct Debit exists but lacks a validated CLABE bank account. Waiting for customer acknowledgment and CLABE validation.active, cancelled
activeThe CLABE is validated and active (and KYC passed for Level 2). The system is ready to perform automated charges. Orders will be generated on schedule.pending, cancelled, completed
pendingA single charge failed, and the direct debit is awaiting merchant manual retry. Only applies to non-recurring scheduled debits.active, cancelled
cancelledThe authorization has been permanently revoked by the merchant. No further orders will be generated.None (Final state)
completedAll scheduled payments have been processed (end date reached or one-time completed).None (Final state)

stateDiagram-v2
    [*] --> created: Create Direct Debit
    
    created --> active: Acknowledgment + CEP<br/>Validation + KYC (Lvl 2)
    created --> cancelled: Merchant Cancels
    
    active --> pending: Single Charge Fails<br/>(max attempts)
    active --> cancelled: Merchant Cancels<br/>(if no pending orders)
    active --> completed: All Payments<br/>Processed
    
    pending --> active: Merchant Retry
    pending --> cancelled: Merchant Cancels
    
    completed --> [*]
    cancelled --> [*]
    
    note right of created
        Initial state after creation.
        Requires:
        - Customer acknowledgment
        - CLABE validation (CEP)
        - KYC (Level 2 only)
    end note
    
    note right of active
        Ready for automated charges.
        Orders generated on schedule.
        Webhook: direct_debit.activated
    end note
    
    note right of pending
        Only for non-recurring
        scheduled debits that fail.
        Requires merchant action.
    end note
    
    note left of completed
        Final state.
        All payments processed
        or end_date reached.
    end note

Core Workflows

Direct Debit Creation

The creation workflow initiates the lifecycle of a Direct Debit by processing initial transaction data and determining the necessary activation steps.

1234

Step 1: Client sends POST

POST /api/direct-debits

The merchant initiates the process by sending a POST request with the initial transaction data to the system.

1. Client sends POST

POST /api/direct-debits

2. System validates data

Business, Flags & Method checks

3. Creates Direct Debit

Status: 'created' | 7-digit Ref

No payment_method_id
Sends activation email

Link for customer to add bank info

Has payment_method_id
Check Verification Status

Is the payment method verified?

Not verified
Sends CLABE validation email
Verified
Shortened Activation

Customer only needs to acknowledge



Direct Debit Activation

This workflow occurs when a customer needs to provide their banking details for the first time to enable the service.

12345

Step 1: Access Activation Link

GET /direct-debit/:id?_v={token}

The user opens the secure link provided in the activation email, which includes a temporary validation token.

1. Customer accesses activation link

GET /direct-debit/:id?_v=token

2. Data Entry + Terms & Conditions

CLABE, RFC (Required), Beneficiary & Consent

3. POST /api/direct-debits/acknowledge

Sends ID, Fingerprint & optional Method ID

4. Verification Triggers

STP Micro-transfer (CEP) + Metadata Capture

CEP Webhook (/api/cep/clabe)
RFC Match Check

Approved if RFC matches bank record

KYC Webhook (Level 2 Only)
Sumsub Identity Verification

Validates official ID and Bio-capture

All Validations Passed
Status: active

Direct Debit is now enabled for recurring charges



CLABE Validation

The validation workflow is used when the system already has the customer's banking information on file but requires explicit confirmation before resuming or starting charges.

12345

Step 1: Access Validation Link

The user clicks the validation link sent via email, which directs them to a secure verification page.


1. Customer accesses validation link

GET /direct-debit/id?_v=token

2. Confirm existing CLABE details

User verifies that stored bank information is correct

3. POST /api/direct-debits/acknowledge

Acknowledges with existing payment_method_id

4. System Processes

Validation skips & Status inheritance

CEP Validation
Verified Check

Skips if verified = true

Level 2 Check
KYC Status

Inherits approved status if exists

Validations Passed
5. Activate Direct Debit

Status: active