Skip to content

Infrastructure

Recurring payments: designing subscriptions, billing cycles, and card-on-file

Understand subscriptions, tokenization, card-on-file, retries, dunning, and the states needed for reliable recurring payments.

16 min readBy Gustavo Sanchez Palencia
Editorial illustration for the article: Recurring payments: designing subscriptions, billing cycles, and card-on-file

Recurring payments look simple from the interface: customers enter a card once, and new charges then happen automatically at defined intervals. Behind that experience lies a combination of customer identity, stored credentials, tokenization, billing schedules, subscription state, authorization, failure handling, notifications, and cancellation.

A well-designed recurring operation is not just a cron job that triggers charges. It is a system that must know who may be charged, for what reason, with which credential, at what time, for how much, how many attempts have been made, and which business state should follow each response.

This is where recurring payments stop being a checkout convenience and become an infrastructure discipline.

What are recurring payments?

Recurring payments are repeated charges associated with an ongoing business relationship, such as a software subscription, streaming service, benefits club, membership fee, professional service, or usage plan.

Recurrence may follow a predictable schedule, such as weekly, monthly, or annually, or depend on product rules. In every case, operations must represent two different things: the business relationship and each individual charge.

The subscription is the relationship. The charge is a financial event within that relationship.

Separating these concepts avoids a common mistake: treating the latest payment as the subscription's entire state. A charge can fail without requiring immediate cancellation. Likewise, a subscription can be canceled even if its last charge was approved.

A subscription and a charge are different entities

A subscription usually carries information such as customer, plan, cycle, start date, next charge, status, cancellation policy, and associated payment credential.

Each charge, in turn, has its own amount, currency, date, attempt, authorization result, and identifiers.

This model answers important operational questions. Which subscription generated this charge? Which charge failed? How many attempts have been made? When should the next attempt occur? Does the customer still have access? Does cancellation prevent future charges? Is there a credit, extension, or grace period?

Without this separation, business rules and financial states become mixed together.

What is card-on-file?

Card-on-file describes a scenario where a card credential is appropriately stored for later use according to applicable payment ecosystem rules.

This does not mean the application should store the card number in plain text. In modern architectures, the goal is to reduce PAN exposure and use tokenization, vaults, or stored credential mechanisms provided by payment infrastructure.

In practice, the merchant works with a secure identifier associated with the credential rather than handling the primary data for every new charge.

This mechanism underpins experiences such as subscriptions, one-click payments, and quick repeat purchases.

Tokenization is central to recurring payments

Tokenization replaces a sensitive credential with a token reusable within a defined scope.

For recurring payments, this allows businesses to initiate new charges without requesting the PAN again each cycle.

But not every token has the same portability. Some belong to a specific PSP or vault context. Others may follow network tokenization models. In a multi-PSP operation, this matters: having a second processing route does not guarantee that the stored credential can be used there.

Tokenization and orchestration strategies must therefore be aligned from the start.

An architecture can look redundant on a diagram and still have a critical dependency in credential storage.

How does a subscription's first payment work?

The first charge usually serves more than one purpose.

It confirms the business intent, checks whether the credential can be used, may initiate tokenization, and creates the subscription's initial state. Depending on the product, it may also involve additional authentication, card validation, or a free trial.

At this point, what the customer authorizes must be clear. Operations must know whether the purchase is one-time or establishes a future billing relationship.

After the first charge, the infrastructure must persist the link between customer, subscription, token, plan, and next billing date.

Subsequent charges can then happen without the same interaction as the initial checkout, according to the model and applicable rules.

Who controls the billing schedule?

There are two common conceptual models.

In the first, the payment platform itself manages the cycle. The application supplies the subscription details and the infrastructure schedules future charges.

In the second, the merchant controls the schedule and sends a new charge on each due date.

Neither model is universally better. The first reduces some operational logic the merchant must maintain. The second offers more control over business rules, extensions, plan changes, credits, and external events.

AZPay documentation covers recurring payment strategies with different levels of control, including weekly, biweekly, monthly, quarterly, semiannual, and annual cycles. The architectural point is to let recurrence fit the business model, not the other way around.

What must happen on the billing date?

On the due date, the infrastructure must determine which subscriptions are eligible for billing, calculate the correct amount, identify the appropriate credential, and create a new financial attempt.

This process must be idempotent.

If a job runs twice or retries after a timeout, the application should not unknowingly create two independent charges for the same cycle.

One way to approach this is to assign a unique identity to the billing cycle. The subscription plus billing period can represent the charge's business intent. Subsequent technical attempts belong to that intent; they do not create a new commercial obligation.

This separation is especially important with automatic retries.

Should a declined charge be retried?

That depends on the cause of failure.

An issuer decline is not equivalent to a network timeout. A temporary technical error is not equivalent to an expired card. An authentication problem is not equivalent to insufficient funds.

Indiscriminate retries can increase costs, create a poor experience, and even introduce operational risks.

A mature strategy classifies failures and determines which qualify for another attempt, when it should occur, and how often it may be made.

Backoff also matters. Repeating the same charge immediately several times rarely solves a problem that requires time to pass.

Dunning is more than retrying

Dunning is the set of strategies used to recover failed recurring charges.

It may involve attempts at different times, customer communication, credential updates, a grace period, progressive service restrictions, and cancellation after a defined limit.

The financial and customer relationship sides must be coordinated.

If a charge fails at 03:00 and another attempt is planned a few hours later, immediately blocking the customer may not make sense. In another business, access may depend on real-time confirmation.

Dunning is therefore a product policy supported by payment infrastructure, not just a technical setting.

How do you handle an expired or replaced card?

Credentials change over time.

Cards expire, are reissued, are replaced after fraud, or are updated by customers. A long-term subscription must anticipate this cycle.

Operations should allow payment methods to be updated without recreating the entire business relationship. The link between subscription and credential must be replaceable.

In models with network tokens and updater services, ecosystem infrastructure may handle some changes. In other cases, the customer must provide a new credential.

What matters is not modeling a subscription as forever dependent on one immutable card identifier.

Recurring payments and 3DS

3DS authentication adds important context to card payments.

The first purchase may occur with the customer present and require authentication under market and transaction rules. Later charges may follow a different pattern depending on the recurring arrangement and stored credential model.

This reinforces the need to correctly represent the relationship from the start. Infrastructure must distinguish a new customer-initiated purchase from a subsequent merchant-initiated charge within an established relationship.

It must also retain the data and references ecosystem participants need to understand the transaction context.

Approval rates must be measured by cycle

A recurring operation should not look only at aggregate approval rates.

Separate the first charge from subsequent charges, as well as method, card network, issuer, country, amount, time, subscription age, and decline reason.

Measuring recovery is also important.

If a hundred charges fail on the first attempt and thirty recover within three days, looking only at the first authorization underestimates final operational performance. Conversely, hiding every failure inside a final metric makes degradation harder to identify.

A mature view tracks initial approval, retry recovery, time to recovery, involuntary churn, and revenue actually preserved.

Involuntary churn is a payment problem

Not every cancellation happens because the customer chose to leave.

A subscription may be lost because a card expired, authorization temporarily failed, a customer did not receive a message, or the retry strategy was inadequate.

This is known as involuntary churn.

It shows how payment infrastructure directly affects retention. Improving credential updates, decline classification, retries, and communication can preserve customers without changing the product sold.

This also explains why approval rates, recurring payments, and observability belong to the same editorial cluster.

Webhooks are essential for keeping state synchronized

Charges do not always complete at the same instant as the request.

A status may change later. An attempt may receive an asynchronous update. A subscription may be canceled through another interface. A refund may change a cycle's financial position.

Webhooks let systems receive these changes without relying solely on polling.

But they must be handled carefully: authentication, deduplication, idempotency, and ordering are essential.

A subscription's state should not regress because an old event arrived after a new one.

How do you cancel a subscription correctly?

Canceling a subscription means preventing future charges according to product policy. This is not necessarily the same as refunding an existing charge.

Operations must distinguish at least immediate cancellation, cancellation at period end, suspension, and reactivation when those states fit the business.

They must also decide what to do with attempts already underway.

If a charge was sent to the processor seconds before cancellation, the system must know how to represent the conflict and what financial action is required.

AZPay documentation includes a specific subscription cancellation operation, reinforcing the importance of treating subscriptions as their own entity rather than a loose sequence of charges.

For Pix, authorization and scheduling controls have their own rules. The guide to Pix Automático for subscriptions explains how to coordinate those states with commercial cancellation and pending charges.

Plan changes complicate recurring payments

Upgrades and downgrades introduce questions absent from a static subscription.

Does the change apply immediately or next cycle? Is there prorated billing? Should credit from the previous plan apply? Does the renewal date change? Does the new amount require confirmation?

These decisions belong to the product but must translate into consistent financial events.

A good architecture avoids embedding all plan rules inside the payment processor. The business system calculates what is owed; the payment layer executes the charge and records the result.

Separating the commercial domain from financial execution keeps the system able to evolve.

Multi-PSP recurring payments require care with credentials

Companies using multiple PSPs may want redundancy for recurring charges too.

The problem is that a token stored at PSP A may not be usable at PSP B. In that case, failover is not just choosing another route. The infrastructure needs a credential compatible with the alternative route.

This detail must be considered before a crisis.

Token portability, vaults, network tokens, and credential collection strategies determine how vendor-independent recurring payments truly are.

Multi-PSP without a credential strategy can create a false sense of resilience.

Switching providers requires one owner per billing period, as well as token compatibility. The guide to PSP migration while preserving recurring payments organizes inventory, piloting, cutover, and historical reconciliation.

Observability must connect subscriptions, charges, and attempts

When a customer asks why they were charged twice or why their subscription was canceled, the team must reconstruct the history.

Which cycle was being billed? How many attempts occurred? Which token was used? Which route processed it? Was there a timeout? Did a webhook change the status? Was there a retry? Was the subscription active at that time?

This requires correlating entities.

Operations should be able to navigate from subscriptions to charges, from charges to attempts, and from attempts to processor events.

Without this chain, support and reconciliation become manual investigations.

Reconciliation closes the financial cycle

A subscription's logical state does not replace financial reconciliation.

The platform may believe a charge was captured, but operations must confirm that subsequent financial events match expectations.

Reconciliation helps identify differences among internal records, processor data, settlement, and payouts.

This scales quickly with recurring payments because one customer can generate dozens of events over years.

Good modeling from the start makes those events easier to explain later.

Which recurring payment metrics should you track?

The first metric is charge success rate on the due date.

Then track retry recovery rate, average recovery time, percentage of subscriptions in dunning, involuntary churn, credential updates, failures by reason, recovered revenue, and cancellations.

It is also useful to track attempt distribution per subscription. If the average rises without improved recovery, the retry policy may merely be adding cost.

Technical metrics such as latency, timeouts, integration errors, and webhook delivery complete the picture.

Recurring payments form a continuously operating system. No single metric tells the entire story.

When do platform-managed recurring payments make sense?

Managed recurrence can make sense when cycles are standardized, the company wants less scheduling logic, and the offered model meets product rules.

It is especially useful when subscription creation, retrieval, and cancellation are already integrated into the same payment infrastructure.

The merchant still needs to synchronize states with its product, control access, and respond to failures, but can delegate part of the financial schedule.

When should you manage recurrence in your own system?

In-house control may be preferable when a business has complex cycles, variable usage, credits, proration, pause rules, product combinations, or external dependencies.

In this model, the merchant's system decides when and how much to charge and uses the payment platform for financial execution.

The advantage is flexibility. The cost is taking on more responsibility for scheduling, idempotency, retries, and state.

The decision should be architectural, not just commercial.

How does AZPay participate in this flow?

AZPay documentation covers recurring billing, tokenization, and subscription operations. This enables journeys where subscriptions are created, retrieved, and canceled within a payment integration, with different billing cycles and reusable credentials.

For merchants, the main point is integrating recurrence without losing the separation between product, subscription, and charge.

The payment platform executes financial capabilities. Business logic still determines who has access, which plan is active, and which commercial policy applies.

This separation creates room to evolve without turning the payment system into the company's entire system.

Recurring payments are a discipline of state

The automatic charge is only the visible part.

The actual system must remember consent, credentials, cycles, amounts, attempts, failures, recovery, cancellation, and asynchronous events. It must also produce predictable responses when two things happen at once.

That is what makes recurrence infrastructure.

A mature operation does not just ask how to charge a card every month. It asks how to represent a financial relationship over time without losing consistency.

With this foundation in place, a subscription stops being a fragile sequence of charges and becomes a controllable, observable flow that can evolve with the business.