> ## Documentation Index
> Fetch the complete documentation index at: https://fastflowpe.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Initiate Subscription

> Use this POST endpoint to initialize a recurring subscription and create the customer mandate authorization flow.

Use the API key in the `x-api-key` header. Do not send it in the `Authorization` header, and cookies are not required.

> [!TIP]
>
> **Quick Reference**
>
> **Required:** Customer information, plan details, and first charge time
>
> **Returns:** `subscription_id`, `merchant_ref_id`, `auth_data`
>
> **Payment Mode:** `UPI_RECURRING`

## Endpoint

```http theme={"dark"}
POST https://api.fastflowpe.com/merchant/recurring/subscription/initialize
```

## Request Headers

**x-api-key** `string` *required*

Your secret API key issued by FastFlowPe.

**Content-Type** `string` *required*

Must be `application/json`.

**Accept** `string` *required*

Must be `application/json`.

## Request Body

### Customer Information

**customer\_info.merchant\_ref\_id** `string` *required*

Your unique reference ID for the subscription. This value must not have been used previously.

**customer\_info.name** `string` *required*

Customer's full name.

**customer\_info.email** `string` *required*

Customer's email address.

**customer\_info.phone** `string` *required*

Customer's phone number.

**customer\_info.payment\_mode** `string` *required*

Payment mode used for the subscription. For recurring UPI mandates, use `UPI_RECURRING`.

**customer\_info.upi\_id** `string`

Customer's UPI ID or VPA.

This field is not mandatory.

**customer\_info.authorization\_amount** `float` *required*

Amount authorized while setting up the mandate. It cannot exceed `plan_amount`.

### Plan Details

**plan\_details.plan\_name** `string` *required*

Display name of the subscription plan.

**plan\_details.plan\_type** `string` *required*

Type of subscription plan.

Supported values:

* `PERIODIC` — charges are scheduled automatically based on the configured interval.
* `ON_DEMAND` — charges can be initiated when required.

**plan\_details.plan\_amount** `float` *required*

Amount charged during each billing cycle.

**plan\_details.plan\_max\_amount** `float` *required*

Maximum amount permitted for a charge under this subscription. It must be greater than or equal to `plan_amount`.

**plan\_details.plan\_max\_cycles** `integer` *required*

Maximum number of billing cycles allowed for the subscription.

**plan\_details.plan\_intervals** `integer` *required*

Number of interval units between recurring charges.

**plan\_details.plan\_interval\_type** `string` *required*

Interval unit used for recurring charges.

Supported values:

* `DAILY`
* `WEEKLY`
* `MONTHLY`
* `YEARLY`

For example, `plan_intervals: 1` with `plan_interval_type: DAILY` means the subscription is charged once every day.

### Subscription Metadata

**subscription\_meta.subscription\_first\_charge\_time** `string` *required*

First scheduled charge time in ISO 8601 format.

Example: `2026-10-07T00:00:00+05:30`

> [!NOTE]
>
> `subscription_expiry_time` is calculated automatically by FastFlowPe.
>
> Authorization details are also created internally using `customer_info.authorization_amount`.

```bash cURL theme={"dark"}
curl --location 'https://api.fastflowpe.com/merchant/recurring/subscription/initialize' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'x-api-key: <your-x-api-key>' \
--data '{
    "customer_info": {
        "merchant_ref_id": "SUB-JONSNOW-001",
        "name": "Jon Snow",
        "email": "jonsnow@example.com",
        "phone": "9876543210",
        "payment_mode": "UPI_RECURRING",
        "upi_id": "9876543210@ptsbi",
        "authorization_amount": 2
    },
    "plan_details": {
        "plan_name": "test-plan",
        "plan_type": "PERIODIC",
        "plan_amount": 100,
        "plan_max_amount": 100,
        "plan_max_cycles": 6,
        "plan_intervals": 1,
        "plan_interval_type": "DAILY"
    },
    "subscription_meta": {
        "subscription_first_charge_time": "2026-10-07T00:00:00+05:30"
    }
}'
```

```python Python theme={"dark"}
import requests

url = "https://api.fastflowpe.com/merchant/recurring/subscription/initialize"
headers = {"Content-Type": "application/json", "Accept": "application/json", "x-api-key": "<your-x-api-key>"}
payload = {
    "customer_info": {
        "merchant_ref_id": "SUB-JONSNOW-001",
        "name": "Jon Snow",
        "email": "jonsnow@example.com",
        "phone": "9876543210",
        "payment_mode": "UPI_RECURRING",
        "upi_id": "9876543210@ptsbi",
        "authorization_amount": 2
    },
    "plan_details": {
        "plan_name": "test-plan",
        "plan_type": "PERIODIC",
        "plan_amount": 100,
        "plan_max_amount": 100,
        "plan_max_cycles": 6,
        "plan_intervals": 1,
        "plan_interval_type": "DAILY"
    },
    "subscription_meta": {
        "subscription_first_charge_time": "2026-10-07T00:00:00+05:30"
    }
}

response = requests.post(url, json=payload, headers=headers)
print(response.json())
```

```javascript Node.js theme={"dark"}
const response = await fetch("https://api.fastflowpe.com/merchant/recurring/subscription/initialize", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "x-api-key": "<your-x-api-key>",
  },
  body: JSON.stringify({
    customer_info: {
      merchant_ref_id: "SUB-JONSNOW-001",
      name: "Jon Snow",
      email: "jonsnow@example.com",
      phone: "9876543210",
      payment_mode: "UPI_RECURRING",
      upi_id: "9876543210@ptsbi",
      authorization_amount: 2,
    },
    plan_details: {
      plan_name: "test-plan",
      plan_type: "PERIODIC",
      plan_amount: 100,
      plan_max_amount: 100,
      plan_max_cycles: 6,
      plan_intervals: 1,
      plan_interval_type: "DAILY",
    },
    subscription_meta: {
      subscription_first_charge_time: "2026-10-07T00:00:00+05:30",
    },
  }),
});
console.log(await response.json());
```

```java Java theme={"dark"}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

String body = """
{
  "customer_info": {
    "merchant_ref_id": "SUB-JONSNOW-001",
    "name": "Jon Snow",
    "email": "jonsnow@example.com",
    "phone": "9876543210",
    "payment_mode": "UPI_RECURRING",
    "upi_id": "9876543210@ptsbi",
    "authorization_amount": 2
  },
  "plan_details": {
    "plan_name": "test-plan",
    "plan_type": "PERIODIC",
    "plan_amount": 100,
    "plan_max_amount": 100,
    "plan_max_cycles": 6,
    "plan_intervals": 1,
    "plan_interval_type": "DAILY"
  },
  "subscription_meta": {
    "subscription_first_charge_time": "2026-10-07T00:00:00+05:30"
  }
}
""";

HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.fastflowpe.com/merchant/recurring/subscription/initialize"))
    .header("Content-Type", "application/json")
    .header("Accept", "application/json")
    .header("x-api-key", "<your-x-api-key>")
    .POST(HttpRequest.BodyPublishers.ofString(body))
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
```

```go Go theme={"dark"}
package main

import (
    "bytes"
    "fmt"
    "io"
    "net/http"
)

func main() {
    payload := []byte(`{
        "customer_info": {
            "merchant_ref_id": "SUB-JONSNOW-001",
            "name": "Jon Snow",
            "email": "jonsnow@example.com",
            "phone": "9876543210",
            "payment_mode": "UPI_RECURRING",
            "upi_id": "9876543210@ptsbi",
            "authorization_amount": 2
        },
        "plan_details": {
            "plan_name": "test-plan",
            "plan_type": "PERIODIC",
            "plan_amount": 100,
            "plan_max_amount": 100,
            "plan_max_cycles": 6,
            "plan_intervals": 1,
            "plan_interval_type": "DAILY"
        },
        "subscription_meta": {
            "subscription_first_charge_time": "2026-10-07T00:00:00+05:30"
        }
    }`)

    req, _ := http.NewRequest("POST", "https://api.fastflowpe.com/merchant/recurring/subscription/initialize", bytes.NewBuffer(payload))
    req.Header.Set("Content-Type", "application/json")
    req.Header.Set("Accept", "application/json")
    req.Header.Set("x-api-key", "<your-x-api-key>")

    resp, _ := http.DefaultClient.Do(req)
    defer resp.Body.Close()
    body, _ := io.ReadAll(resp.Body)
    fmt.Println(string(body))
}
```

```php PHP theme={"dark"}
<?php
$payload = json_encode([
    "customer_info" => [
        "merchant_ref_id" => "SUB-JONSNOW-001",
        "name" => "Jon Snow",
        "email" => "jonsnow@example.com",
        "phone" => "9876543210",
        "payment_mode" => "UPI_RECURRING",
        "upi_id" => "9876543210@ptsbi",
        "authorization_amount" => 2,
    ],
    "plan_details" => [
        "plan_name" => "test-plan",
        "plan_type" => "PERIODIC",
        "plan_amount" => 100,
        "plan_max_amount" => 100,
        "plan_max_cycles" => 6,
        "plan_intervals" => 1,
        "plan_interval_type" => "DAILY",
    ],
    "subscription_meta" => [
        "subscription_first_charge_time" => "2026-10-07T00:00:00+05:30",
    ],
]);

$ch = curl_init("https://api.fastflowpe.com/merchant/recurring/subscription/initialize");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Content-Type: application/json",
    "Accept: application/json",
    "x-api-key: <your-x-api-key>",
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
```

```ruby Ruby theme={"dark"}
require 'net/http'
require 'uri'
require 'json'

uri = URI('https://api.fastflowpe.com/merchant/recurring/subscription/initialize')
request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request['Accept'] = 'application/json'
request['x-api-key'] = '<your-x-api-key>'
request.body = {
  customer_info: {
    merchant_ref_id: 'SUB-JONSNOW-001',
    name: 'Jon Snow',
    email: 'jonsnow@example.com',
    phone: '9876543210',
    payment_mode: 'UPI_RECURRING',
    upi_id: '9876543210@ptsbi',
    authorization_amount: 2,
  },
  plan_details: {
    plan_name: 'test-plan',
    plan_type: 'PERIODIC',
    plan_amount: 100,
    plan_max_amount: 100,
    plan_max_cycles: 6,
    plan_intervals: 1,
    plan_interval_type: 'DAILY',
  },
  subscription_meta: {
    subscription_first_charge_time: '2026-10-07T00:00:00+05:30',
  },
}.to_json

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(request) }
puts response.body
```

## Response

A successful request returns a `200` status with the FastFlowPe subscription ID, merchant reference ID, and authorization information required to complete the mandate.

```json Success theme={"dark"}
{
  "status": "success",
  "status_code": 200,
  "message": "Subscription created. Redirect customer to complete mandate authorization.",
  "detail": null,
  "data": {
    "subscription_id": "YOUR_INTERNAL_SUBSCRIPTION_UUID",
    "merchant_ref_id": "SUB-JONSNOW-001",
    "auth_data": {
      "url": "https://payments.cashfree.com/subscriptions/checkout/timer",
      "method": "post",
      "payload": {
        "paymentType": "UPI",
        "upiIntentData": {
          "iosAuthAppLinks": {
            "BHIM": "bhim://...",
            "GPAY": "tez://...",
            "PHONEPE": "phonepe://..."
          },
          "androidAuthAppLinks": {
            "BHIM": "bhim://...",
            "GPAY": "gpay://...",
            "PHONEPE": "phonepe://...",
            "DEFAULT": "upi://..."
          }
        }
      },
      "content_type": "application/json"
    }
  },
  "meta": null
}
```

```json Failure theme={"dark"}
{
  "status": "failure",
  "status_code": 400,
  "message": "Subscription creation failed",
  "detail": null,
  "data": {
    "subscription_id": "INTERNAL_SUBSCRIPTION_ID",
    "error_message": "Error returned by PSP",
    "raw_response": {}
  },
  "meta": null
}
```

**subscription\_id** `string`

Unique FastFlowPe subscription ID created for this subscription.

Save this value for future subscription operations.

**merchant\_ref\_id** `string`

Merchant reference ID originally provided in `customer_info.merchant_ref_id`.

Use this value to map the FastFlowPe subscription to your internal subscription record.

**auth\_data** `object`

Authorization information required for the customer to complete the recurring mandate setup.

**auth\_data.url** `string`

URL used as part of the mandate authorization flow.

**auth\_data.method** `string`

HTTP method associated with the authorization request.

**auth\_data.payload** `object`

Payment authorization payload containing UPI authorization information.

**auth\_data.payload.paymentType** `string`

Payment type used for mandate authorization. For UPI recurring subscriptions, this is `UPI`.

**auth\_data.payload.upiIntentData** `object`

Contains platform-specific UPI application links that can be used to complete mandate authorization.

**auth\_data.payload.upiIntentData.iosAuthAppLinks** `object`

UPI application deep links returned for supported iOS apps such as BHIM, Google Pay, and PhonePe.

**auth\_data.payload.upiIntentData.androidAuthAppLinks** `object`

UPI application deep links returned for supported Android apps.

A generic `DEFAULT` UPI link may also be returned.

**auth\_data.content\_type** `string`

Content type of the authorization payload. Typically `application/json`.

**error\_message** `string`

Error message returned when the subscription could not be created.

This field is present in failure responses.

**raw\_response** `object`

Raw response returned by the PSP when subscription creation fails.

> [!NOTE]
>
> Creating the subscription does not mean that the mandate has been authorized.
>
> The customer must complete the mandate authorization using the information returned in `auth_data`.

> [!TIP]
>
> Save both `subscription_id` and `merchant_ref_id`. Use `subscription_id` for FastFlowPe subscription operations and `merchant_ref_id` to correlate the subscription with your own records.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.