Recurring Payments & Auto-Debit
Auto-debit is a financial arrangement where a customer authorizes a merchant to automatically deduct money from their saved card. This covers subscriptions, installments, recurring billing, and event-based charges โ all processed without the customer needing to be present after the initial setup.
Ottu offers SDKs and tools to speed up your integration. See Getting Started for all available options.
When to Useโ
- Subscriptions โ monthly or annual recurring charges for SaaS, memberships, or content
- Installment payments โ split a single purchase into multiple scheduled charges
- On-demand billing โ charge customers when events occur (e.g., account top-ups, usage-based billing)
- Recurring invoices โ automatically collect payment on invoice due dates
Setupโ
Before implementing auto-debit, ensure you have:
- A Payment Gateway with auto-debit capability enabled
- The Checkout API for creating payment sessions
- Tokenization set up โ cards must be tokenized before they can be auto-debited
- A webhook endpoint configured to receive payment notifications
- Familiarity with the User Cards API for card management
Guideโ
Key Conceptsโ
Auto-debit payments involve two types of transactions:
- CIT (Cardholder Initiated Transaction) โ The first payment where the customer is present, enters their card details, and authorizes future charges. This establishes the agreement and saves the card token.
- MIT (Merchant Initiated Transaction) โ Subsequent automatic charges triggered by the merchant using the saved token. The customer is not present during these transactions.
Agreementโ
An agreement is a commercial contract between you and your customer that authorizes you to store and use their payment details for subsequent transactions. Each agreement has:
- A unique
idthat you define - A
type(recurring, unscheduled, or installment) - Scheduling parameters (
frequency,cycle_interval_days,total_cycles,expiry_date) - Amount rules (
amount_variability: fixed or variable)
Only one card can be linked to an agreement at any time. To change the card, a new CIT (customer-present) transaction is required.
Agreement Typesโ
| Type | Use Case | Required Fields |
|---|---|---|
| Recurring | Subscriptions, regular billing | id, frequency, amount_variability, expiry_date, cycle_interval_days, total_cycles |
| Unscheduled | On-demand charges (e.g., account top-ups) | id, frequency |
| Installment | Split payments for a single purchase | id, frequency, amount_variability, expiry_date, cycle_interval_days, total_cycles, seller |
Workflowโ
- CIT โ Merchant creates a session with
payment_type: auto_debitand anagreementobject. - Payment โ Customer enters their card via the Checkout SDK or hosted page and completes 3DS authentication.
- Webhook โ Ottu delivers the token. Save
token.tokenandtoken.pg_codefor future charges. - MIT โ Merchant charges the token by creating a new session, then calling the Native Payments API (or using One-Step Checkout).
- Result โ The Native Payments API (or One-Step Checkout) returns the payment result directly in the API response โ there is no webhook for MIT charges. No customer interaction needed.
Live Demoโ
Experience the complete recurring payment lifecycle. Save a test card, watch the webhook deliver the token in real time, then charge the card automatically โ choose between Two-Step or One-Step checkout.
Try Recurring Payments
Experience the full CIT/MIT flow: save a card with a test payment, then charge it automatically โ all in sandbox mode.
Step-by-Stepโ
First Payment (CIT)โ
Discover Payment Methods
Create Payment Session
Collect Card Details
Receive Webhook with Token
auto_debit: true to discover which gateways support tokenization and auto-debit.POST /b/pbl/v2/payment-methods/
{
"plugin": "payment_request",
"operation": "purchase",
"currencies": ["KWD"],
"auto_debit": true
}
pg_codes in the next step.Subsequent Payments (MIT)โ
Once you have the token, you can charge the customer automatically using either of the following approaches.
Two-Step (Checkout API + Native Payments API):
- Create a new session via the Checkout API with the same
pg_code,agreement.id, andcustomer_id - Call the Native Payments API with the
session_idandtoken:
{
"session_id": "19aa7cd3cfc43d9d7641f6c433767b25cbcd6c18",
"token": "9923965822244314"
}
Use the same pg_code, agreement.id, and customer_id as the first payment. The amount may vary if the agreement's amount_variability is set to "variable".
One-Step (Checkout API with payment_instrument):
Combine session creation and payment in a single call using payment_instrument. To see this in action, try the Live Demo above.
{
"type": "e_commerce",
"amount": "19.000",
"payment_type": "auto_debit",
"currency_code": "KWD",
"pg_codes": ["credit-card"],
"customer_id": "cust_123",
"webhook_url": "https://yourwebsite.com/webhook",
"agreement": { "id": "A123456789", "type": "recurring" },
"payment_instrument": {
"instrument_type": "token",
"payload": { "token": "9923965822244314" }
}
}
Use Casesโ
Updating Card Informationโ
Card changes for auto-debit always require a CIT (the customer must be present):
Customer-Initiated Update:
- Customer visits your card management section
- Your backend creates a new Checkout session with the same
agreement.id - Present the Checkout SDK or redirect to
checkout_url - Customer selects or enters a new card
- After successful payment, the new card is associated with the agreement
- You receive the updated token via webhook
Merchant-Requested Update:
When a card is about to expire or a payment fails, notify the customer via email/SMS with a direct link to a checkout page where they can enter a new card.
Set up notifications for upcoming card expirations to avoid disruptions. Prompt customers to update their card details before expiry.
Error Handlingโ
When an MIT payment fails:
- Notify the customer โ send an email/SMS explaining the failure reason
- Provide a payment link โ include a
checkout_urlso the customer can pay manually - Retry after 24 hours โ create a new session with appropriate grace period parameters
- Allow card update โ the customer may need to update their saved card
Common failure reasons:
- Insufficient funds โ retry after a delay
- Expired card โ request card update from customer
- Gateway decline โ check with payment gateway for details
- Token invalidated โ requires new CIT to re-establish
Pre-Charge Notificationsโ
For recurring billing, notify customers before each charge:
- 1 week before โ upcoming charge notification
- 1 day before โ final reminder with option to modify
- Include a link to update card or cancel subscription
API Referenceโ
Native Payment API(Auto Debit)โ
Best Practicesโ
- Track schedules โ maintain a scheduling system for recurring payment dates
- Keep records โ store detailed transaction records for reconciliation and dispute handling
- Communicate โ send clear pre-charge and post-charge notifications to customers
- Include links โ always provide direct checkout links in notifications for easy card updates
- Handle failures gracefully โ implement retry logic with increasing intervals
- Monitor token health โ track card expirations and proactively request updates
FAQโ
What's Next?โ
- Operations โ Refund, capture, or void auto-debit transactions
- Webhooks โ Handle payment notifications for recurring charges
- User Cards โ Manage saved cards and retrieve tokens
- One-Step Checkout โ Combine session creation and payment in a single call