# Recurring payments with stored card details
If a customer is setting up a series of repeat payments, you can store their card details during the initial cardholder-initiated transaction (CIT). You can then use the stored details to request payment for subsequent card-not-present (CNP) transactions in the payment series. These types of transactions are referred to as merchant-initiated transactions (MITs).
For example, if a customer makes a payment via an explicit user interaction such as selecting a _Pay_ button, it's considered a CIT. An MIT is a payment that the customer is not actively participating in when it's initiated.
> **Note**
>
> MIT installments are not supported for American Express, Discover, or Mada payments.
---
## SCA requirements
In regions that require Strong Customer Authentication (SCA), you must enable [3D Secure (3DS)](https://www.checkout.com/docs/payments/authenticate-payments/3d-secure.md) authentication for the initial payment by setting `3ds.enabled` to `true` in the initial payment request.
If you do not supply the required information, your payment request has a higher risk of declining with a `20154` response code. If this happens, we [automatically upgrade the payment to 3DS](https://www.checkout.com/docs/risk-management/3d-secure/automated-sca-soft-decline-retry.md) and retry the transaction. See [SCA compliance](https://www.checkout.com/docs/business-operations/ensure-regulatory-compliance/sca-compliance.md) for more information.
You must also set `3ds.challenge_indicator` to `challenge_requested_mandate` to prevent subsequent CNP transactions from being declined.
> **Information**
>
> If the transaction qualifies, you can also make use of [3DS exemptions](https://www.checkout.com/docs/risk-management/3d-secure/sessions/3ds-exemptions.md).
For more information, see [SCA compliance](https://www.checkout.com/docs/business-operations/ensure-regulatory-compliance/sca-compliance.md).
---
## Store card details during the initial transaction
To store the card details during the CIT in which the customer sets up the agreement, call the [Request a payment or payout](https://api-reference.checkout.com/tag/Payments/#operation/requestAPaymentOrPayout) endpoint with the following fields:
- `payment_type` – Set to `Installment` or `Recurring`.
- `merchant_initiated` – Set to `false`.
You do not need to set `source.store_for_future_use` to `true`. `Installment` and `Recurring` payments automatically request to store the cardholder's details.
> **Information**
>
> Your base URL's `{prefix}` value is unique to your account and environment. To learn how to retrieve your base URLs for the sandbox and production environments, see [API endpoints](https://www.checkout.com/docs/developer-resources/api/api-endpoints.md).
**Production**
`POST` `https://{prefix}.api.checkout.com/payments`
**Sandbox**
`POST` `https://{prefix}.api.sandbox.checkout.com/payments`
### Request examples
**Full card details**
```json
{
"source": {
"type": "card",
"number": 4242424242424242,
"expiry_month": 10,
"expiry_year": 2026
},
"amount": 5000,
"currency": "USD",
"payment_type": "Recurring",
"merchant_initiated": false,
"3ds": {
"enabled": true,
"challenge_indicator": "challenge_requested_mandate"
}
}
```
**Card token**
```json
{
"source": {
"type": "token",
"token": "tok_tokenguid"
},
"amount": 5000,
"currency": "USD",
"payment_type": "Recurring",
"merchant_initiated": false,
"3ds": {
"enabled": true,
"challenge_indicator": "challenge_requested_mandate"
}
}
```
**Network token**
```json
{
"source": {
"type": "network_token",
"token": "4111111111111111",
"token_type": "vts",
"expiry_month": "10",
"expiry_year": "2025",
"eci": "06",
"cryptogram": "AgAAAAAAAIR8CQrXcIhbQAAAAAA="
},
"amount": 5000,
"currency": "USD",
"payment_type": "Recurring",
"merchant_initiated": false,
"3ds": {
"enabled": true,
"challenge_indicator": "challenge_requested"
}
}
```
### Response example
```json
{
"id": "pay_4hlqceyyib5ezpxtpdpwfhwtda",
"status": "Pending",
"reference": "ORD-5023-4E89",
"3ds": {
"downgraded": false,
"enrolled": "Y"
},
"source": {
"type": "id",
"id": "src_nwd3m4in3hkuddfpjsaevunhdy"
},
"_links": {
"self": {
"href": "https://{prefix}.api.sandbox.checkout.com/payments/pay_fbfrj7f3bwou5bdgmzsryd223i"
},
"actions": {
"href": "https://{prefix}.api.sandbox.checkout.com/payments/pay_fbfrj7f3bwou5bdgmzsryd223i/actions"
},
"redirect": {
"href": "https://{prefix}.api.sandbox.checkout.com/redirect/act_y3oqhf46pyzuxjbcn2giaqnb44"
}
}
}
```
The response returns a payment instrument, which contains the stored card details, in the `source.id` field. Use the payment instrument ID to request future payments.
> **Information**
>
> For Mastercard payments, the `processing.scheme_transaction_link_id` in the response is the Mastercard Transaction Link Identifier (TLID). See [Mastercard Transaction Link Identifier
> ](https://support.checkout.com/hc/en-us/articles/33589249067538) for more information.
---
## Request a payment in a subsequent MIT
Once the customer has set up a payment agreement, you can initiate subsequent CNP transactions in the payment series. For example, if the customer pays using auto-renewal at the end of a subscription period.
Call the [Request a payment or payout](https://api-reference.checkout.com/tag/Payments/#operation/requestAPaymentOrPayout) endpoint with the following fields:
- `payment_type` – Set to `Installment` or `Recurring`.
- `merchant_initiated` – Set to `true`.
- `previous_payment_id` – Set to one of the following:
- The payment ID of the initial CIT.
- The payment ID of a previous MIT in the payment series.
- The card scheme's transaction ID, if previous transactions in the payment series were processed by another payment service provider (PSP). The value you provide must meet the [scheme's transaction ID requirements](#Scheme_transaction_ID_requirements).
> **Information**
>
> For Mastercard payments, Checkout.com resolves the Transaction Link Identifier (TLID) based on the `previous_payment_id` value you provide.
If you do not provide a `previous_payment_id` and the previous payment was processed by us, we automatically attempt to retrieve the payment ID from the initial CIT in the payment series.
If the fallback mechanism fails to find a payment ID, we attempt to apply relevant exemptions.
If the previous payments were processed by a different payment provider, you must provide both the TLID and the previous payment ID.
> **Note**
>
> Do not use the fallback mechanism as your primary method of managing transaction IDs.
> **Information**
>
> Your base URL's `{prefix}` value is unique to your account and environment. To learn how to retrieve your base URLs for the sandbox and production environments, see [API endpoints](https://www.checkout.com/docs/developer-resources/api/api-endpoints.md).
**Production**
`POST` `https://{prefix}.api.checkout.com/payments`
**Sandbox**
`POST` `https://{prefix}.api.sandbox.checkout.com/payments`
### Request example
```json
{
"source": {
"type": "id",
"id": "src_nwd3m4in3hkuddfpjsaevunhdy"
},
"amount": 5000,
"currency": "USD",
"payment_type": "Recurring",
"merchant_initiated": true,
"previous_payment_id": "pay_4hlqceyyib5ezpxtpdpwfhwtda"
}
```
Merchant-initiated transactions fall out of scope of SCA and qualify for merchant-initiated exemptions, which means 3DS authentication is not required.
You can either set `3ds.enabled` to `false`, or omit it from the request.
> **Note**
>
> If you process a payment with full card details or network tokens stored in a card-on-file system external to Checkout.com, you must set `source.stored` to `true` in the request.
**Full card details**
```json
{
"source": {
"type": "card",
"number": 4242424242424242,
"expiry_month": 10,
"expiry_year": 2026,
"stored": true
},
"amount": 5000,
"currency": "USD",
"payment_type": "Recurring",
"merchant_initiated": true,
"previous_payment_id": "pay_4hlqceyyib5ezpxtpdpwfhwtda"
}
```
**Network token**
```json
{
"source": {
"type": "network_token",
"token": "4111111111111111",
"token_type": "vts",
"expiry_month": "10",
"expiry_year": "2025",
"eci": "06",
"cryptogram": "AgAAAAAAAIR8CQrXcIhbQAAAAAA=",
"stored": true
},
"amount": 5000,
"currency": "USD",
"payment_type": "Recurring",
"merchant_initiated": true
}
```
### Response example
```json
{
"id": "pay_4prafl3phiyejkfrjtgzlh4kye",
"action_id": "act_ep5277oczf7u7lg6hrsscbt6xy",
"amount": 100,
"currency": "USD",
"approved": true,
"status": "Authorized",
"auth_code": "482LT5",
"response_code": "10000",
"response_summary": "Approved",
"balances": {
"total_authorized": 100,
"total_voided": 0,
"available_to_void": 100,
"total_captured": 0,
"available_to_capture": 100,
"total_refunded": 0,
"available_to_refund": 0
},
"risk": {
"flagged": false
},
"source": {
"id": "src_y4pwpefkykre7ijbeyxjsxdkf4",
"type": "card",
"expiry_month": 12,
"expiry_year": 2025,
"scheme": "Visa",
"last4": "4242",
"fingerprint": "005D09BED0F110E7B3B13407DF0167F6E68C2FEFAB094D49DA4B4BFAE459C569",
"bin": "424242",
"card_type": "CREDIT",
"card_category": "CONSUMER",
"issuer": "Test Bank",
"issuer_country": "GB",
"product_id": "F",
"product_type": "Visa Classic",
"payment_account_reference": ""
},
"processed_on": "2023-01-25T16:42:20.8748358Z",
"reference": "ORD-5023-4E89",
"scheme_id": "481108533665280",
"processing": {
"acquirer_transaction_id": "931228481108533665280",
"retrieval_reference_number": "302516931228"
},
"expires_on": "2023-02-01T16:42:20.8106477Z",
"_links": {
"self": {
"href": "https://{prefix}.api.sandbox.checkout.com/payments/pay_fbfrj7f3bwou5bdgmzsryd223i"
},
"actions": {
"href": "https://{prefix}.api.sandbox.checkout.com/payments/pay_fbfrj7f3bwou5bdgmzsryd223i/actions"
},
"redirect": {
"href": "https://{prefix}.api.sandbox.checkout.com/redirect/act_y3oqhf46pyzuxjbcn2giaqnb44"
}
}
}
```
> **Information**
>
> You may be able to automatically retry failed payments if you [configure scheduled retries](https://www.checkout.com/docs/payments/manage-payments/configure-scheduled-retries.md), or enable [automatic downtime retries](https://www.checkout.com/docs/payments/manage-payments/configure-scheduled-retries.md#Automatic_downtime_retries).
### Scheme transaction ID requirements
> **Information**
>
> The following table is not an exhaustive list of supported schemes. Other schemes that are not listed may have their own format requirements.
| Card scheme | Requirements |
| --- | --- |
| Visa | - The ID length must be 15 characters.
- The ID must start with number three, four, or five. |
| Mastercard | - The ID length must be 13 characters.
- The first three characters must be a valid product code.
- The last four characters must be in `MMDD` format. For example, `0227`. |
| Diners Club | - The ID length must be 15 characters.
- The ID must start with number one, seven, or eight. |
| Cartes Bancaires | - The ID length must be 16 characters.
- The ID must be in hexadecimal format and start with number one. |
> **Information**
>
> If the card scheme cannot find the original transaction ID, you may see an increase in soft declines.