# Take a recurring payment

> Everything needed to collect from a customer on a schedule with One API, from the consent the customer gives once through to each collection and the webhook that reports it.

A recurring payment is two separate things: consent, which the customer gives
once, and collection, which you trigger for each amount afterwards. They are
different calls and they fail for different reasons.

**Capitec is the only supported bank today**, on a limited rollout to approved
merchants. A customer who banks elsewhere needs a standard payment each cycle,
so that fallback is part of the design rather than an afterthought.

Four steps: create the subscription, redirect the customer to consent, action a
payment against that consent, handle the webhook. **A collection is not
confirmed by the response to the call that triggered it.** The outcome arrives
on the webhook, exactly as it does for a one-off payin.

Subscription statuses are their own set, separate from a collection's. A
subscription sits at `PendingAuthorization` until the customer approves consent
in their banking app, and only an `Active` one can be collected against; an
individual collection carries `Pending`, `Successful` or `Failed` instead. Copy
every name as written, including `Canceled`, which has one `l`.

## What this was built from

- Ozow Hub, commit `e0b2a572`
- `one-api` version 1.0, OpenAPI document: https://hub.ozow.com/api-reference/specs/one-api.yaml
- Build against `https://one.ozow.com/v1` for `one-api`
- 7 pages, 16 operations
- Everything below inlined in one document: https://hub.ozow.com/bundles/take-a-recurring-payment-full.md

## Implement against these

Every field name, order and format on these pages is exact.

- [Recurring payments](https://hub.ozow.com/integration-methods/apis/recurring-payments/set-up-recurring-payments.md): Collect repeat payments with One API. One consent the customer approves, then merchant-initiated collections that need no further customer action.
- [Verify a webhook signature](https://hub.ozow.com/integration-methods/apis/payin/verify-a-webhook.md): The signature on a One API webhook, the five steps that check it, and a working implementation in four languages.

## Background

Context for the above. Nothing here is implemented against.

- [How Ozow works](https://hub.ozow.com/getting-started.md): How Ozow connects you to South African banks and payment methods, and the two directions money moves: payins from customers, payouts to recipients.
- [Prerequisites and onboarding](https://hub.ozow.com/getting-started/prerequisites-and-onboarding.md): What to have in place before you write any code: a merchant account, Dashboard access, your credentials, and payout eligibility if you need it.
- [Recurring payments](https://hub.ozow.com/payment-products/recurring-payments.md): Charge a customer repeatedly after a single authorisation.
- [Transaction and settlement statuses](https://hub.ozow.com/integration-methods/statuses.md): Every payin, payout, refund and settlement status, which are final, and what to do about each.
- [Building a secure integration](https://hub.ozow.com/getting-started/building-a-secure-integration.md): Where Ozow's security responsibility ends and yours begins: credentials, webhook endpoints, verifying notifications, and validating amounts.

## The contract

Fetch the OpenAPI document named above to generate a client, or to check a field name or an enum against the schema.

- [one-api#get-/subscriptions/{subscriptionId}](https://hub.ozow.com/api-reference/one-api/get-subscriptions-subscription-id.md)
- [one-api#get-/webhooks/{id}/secret](https://hub.ozow.com/api-reference/one-api/get-webhooks-id-secret.md)
- [one-api#post-/subscriptions](https://hub.ozow.com/api-reference/one-api/post-subscriptions.md)
- [one-api#post-/subscriptions/{subscriptionId}/cancel](https://hub.ozow.com/api-reference/one-api/post-subscriptions-subscription-id-cancel.md)
- [one-api#post-/subscriptions/{subscriptionId}/transactions](https://hub.ozow.com/api-reference/one-api/post-subscriptions-subscription-id-transactions.md)
- [one-api#post-/token](https://hub.ozow.com/api-reference/one-api/post-token.md)
- [one-api#schema/WebhookEnvelope](https://hub.ozow.com/api-reference/one-api/schemas/webhook-envelope.md)
- [one-api#schema/WebhookEventData](https://hub.ozow.com/api-reference/one-api/schemas/webhook-event-data.md)
- [one-api#webhook/subscription.authorization.failed](https://hub.ozow.com/api-reference/one-api/webhooks/subscription-authorization-failed.md)
- [one-api#webhook/subscription.authorization.success](https://hub.ozow.com/api-reference/one-api/webhooks/subscription-authorization-success.md)
- [one-api#webhook/subscription.canceled](https://hub.ozow.com/api-reference/one-api/webhooks/subscription-canceled.md)
- [one-api#webhook/subscription.completed](https://hub.ozow.com/api-reference/one-api/webhooks/subscription-completed.md)
- [one-api#webhook/subscription.expired](https://hub.ozow.com/api-reference/one-api/webhooks/subscription-expired.md)
- [one-api#webhook/subscription.transaction.failed](https://hub.ozow.com/api-reference/one-api/webhooks/subscription-transaction-failed.md)
- [one-api#webhook/subscription.transaction.success](https://hub.ozow.com/api-reference/one-api/webhooks/subscription-transaction-success.md)
- [one-api#webhook/transaction.complete](https://hub.ozow.com/api-reference/one-api/webhooks/transaction-complete.md)
