# Create Subscription

`/recurrent/plan/create`

<mark style="color:green;">`POST`</mark> `https://merchants.seerbitapi.com/api/v1/recurrent/plan/create`

#### Headers

| Name          | Type   | Description  |
| ------------- | ------ | ------------ |
| Authorization | String | Bearer Token |

#### Request Body

| Name                                                 | Type    | Description                                                                                                                                                                                                              |
| ---------------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| publicKey<mark style="color:red;">\*</mark>          | String  | This is the merchant public key.                                                                                                                                                                                         |
| amount<mark style="color:red;">\*</mark>             | String  | This is the amount to be paid.                                                                                                                                                                                           |
| email<mark style="color:red;">\*</mark>              | String  | This is the email of the customer.                                                                                                                                                                                       |
| country<mark style="color:red;">\*</mark>            | String  | This is the country from which the transaction is been carried out from                                                                                                                                                  |
| paymentReference<mark style="color:red;">\*</mark>   | String  | This is the unique identifier for a transaction, to be generated by merchant.                                                                                                                                            |
| planId                                               | String  | the planId represents a product of the merchant that the customer wants to pay for e.g DSTV bouqet.                                                                                                                      |
| CardNumber<mark style="color:red;">\*</mark>         | String  | this is the name of the cardholder                                                                                                                                                                                       |
| expiryYear<mark style="color:red;">\*</mark>         | String  | this is the card's expiry year                                                                                                                                                                                           |
| expiryMonth<mark style="color:red;">\*</mark>        | String  | this is the card's expiry month                                                                                                                                                                                          |
| cvv<mark style="color:red;">\*</mark>                | String  | this is the 3 digit code behind the debit card                                                                                                                                                                           |
| productDescription<mark style="color:red;">\*</mark> | String  | this is the product description supplied by the merchant                                                                                                                                                                 |
| billingCycle<mark style="color:red;">\*</mark>       | String  | this is the rate of reoccurrence of the charge to the tokenized card                                                                                                                                                     |
| subscriptionAmount<mark style="color:red;">\*</mark> | boolean | this is passed as true if the subscription amount is to be charged at the point of creating subscription. It is passed as false if the default amount of SeerBit is to be charged at the point of creating subscription. |
| mobileNumber<mark style="color:red;">\*</mark>       | String  | customer's number                                                                                                                                                                                                        |
| customerId                                           | String  |                                                                                                                                                                                                                          |
| billingPeriod<mark style="color:red;">\*</mark>      | String  | this is the number of times seerBit will do a recurrent billing                                                                                                                                                          |
| redirectUrl<mark style="color:red;">\*</mark>        | String  | this is returned when the payment link service is called                                                                                                                                                                 |

{% tabs %}
{% tab title="cURL" %}

```javascript
curl --location 'https://merchants.seerbitapi.com/api/v1/recurrent/plan/create' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer Token\
--data '{
    "productId": "<Plan name>",
    "productDescription": "<Description of Plan>",
    "amount": "100",
    "billingCycle": "HOURLY",
    "limit": 5,
    "publicKey": "<public key>",
    "country": "NG",
    "currency": "NGN",
    "allowPartialDebit": false
}'
```

{% endtab %}

{% tab title="200: OK Successful" %}

```javascript
{
    "payload": {
        "country": "NG",
        "createdAt": 1715607343498,
        "amount": 100,
        "productId": "<Plan name>",
        "billingCycle": "HOURLY",
        "currency": "NGN",
        "payUrl": "https://pay.seerbitapi.com/db1ea861993689a57dac",
        "details": {
            "country": "NG",
            "amount": 100,
            "productId": "<Plan name>",
            "allowPartialDebit": false,
            "payLinkUrl": "https://pay.seerbitapi.com/db1ea861993689a57dac",
            "publicKey": "<public key>",
            "createdAt": 1715607343498,
            "trialDuration": 0,
            "trialPeriod": false,
            "billingCycle": "HOURLY",
            "limit": 5,
            "planId": "db1ea861993689a57dac",
            "currency": "NGN",
            "id": 20031,
            "productDescription": "<description of plan>",
            "updatedAt": null,
            "status": "ACTIVE"
        },
        "publicKey": "<public key>",
        "plan": "db1ea861993689a57dac",
        "productDescription": "<description of plan>"
    },
    "message": "Successful",
    "status": "SUCCESS",
    "responseCode": "00"
}
```

{% endtab %}

{% tab title="401: Unauthorized Invalid Authentication Token" %}

```javascript
{
  "message": "Invalid Authentication Token",
  "error": "INPUT"
}
```

{% endtab %}

{% tab title="400: Bad Request Bad Request" %}

```javascript
{
"message": "Bad Request",
"error": "There has been a problem with reading or understanding the request."
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://apis.seerbit.com/api-endpoints/subscriptions/create-subscription.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
