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

# Create Subscription

This API is used to create a new subscription for a customer.

### Request Body

```json theme={null}
{
  "customer_id": "string", // ID of the customer
  "plan_id": "string", // ID of the subscription plan
  "start_date": "string", // Start date of the subscription
  "hash": "string" // Calculated hash for request validation
}
```

### Responses

#### 200 OK

```json theme={null}
{
  "status": true,
  "subscription_id": "string",
  "message": "Subscription created successfully"
}
```

#### 400 Bad Request

```json theme={null}
{
  "status": false,
  "error": {
    "message": "Invalid request",
    "code": 400
  }
}
```


## OpenAPI

````yaml POST /api/v1/subscription/create
openapi: 3.1.0
info:
  title: Orchestration
  version: '1'
servers:
  - url: https://api.paytring.com
security:
  - sec0: []
paths:
  /api/v1/subscription/create:
    post:
      summary: Create Subscriptions
      operationId: create-subscriptions
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - key
                - callback_url
                - cname
                - email
                - phone
                - plan_id
                - mer_reference_id
                - hash
              properties:
                key:
                  type: string
                  description: Merchant key, available in dashboard profile section
                pg:
                  type: string
                  description: code for payment gateway, which you want to use
                pg_pool_id:
                  type: string
                  description: pool is from which you want to choose pg
                callback_url:
                  type: string
                cname:
                  type: string
                email:
                  type: string
                phone:
                  type: string
                initial_amount:
                  type: string
                plan_id:
                  type: string
                mer_reference_id:
                  type: string
                hash:
                  type: string
                  description: >-
                    to be calculated by key sort of all non-object key values of
                    this request
                notes:
                  type: object
                  properties:
                    udf1:
                      type: string
                      description: max length 255, no special chars
                    udf2:
                      type: string
                      description: max length 255, no special chars
                    udf3:
                      type: string
                      description: max length 255, no special chars
                    udf4:
                      type: string
                      description: max length 255, no special chars
                    udf5:
                      type: string
                      description: max length 255, no special chars
                billing_address:
                  type: object
                  properties:
                    line1:
                      type: string
                      description: does not accept any special charecter
                    line2:
                      type: string
                      description: does not accept any special charecter
                    city:
                      type: string
                    state:
                      type: string
                    zipcode:
                      type: integer
                      format: int32
                    country:
                      type: string
                    phone:
                      type: string
                    firstname:
                      type: string
                      description: min 3 chars
                    lastname:
                      type: string
                      description: min 3 chars
                shipping_address:
                  type: object
                  properties:
                    line1:
                      type: string
                      description: does not accept any special charecter
                    line2:
                      type: string
                      description: does not accept any special charecter
                    city:
                      type: string
                    state:
                      type: string
                    zipcode:
                      type: integer
                      format: int32
                    country:
                      type: string
                    phone:
                      type: string
                    firstname:
                      type: string
                      description: min 3 chars
                    lastname:
                      type: string
                      description: min 3 chars
      responses:
        '200':
          description: '200'
          content:
            application/json:
              examples:
                Result:
                  value: '{}'
              schema:
                type: object
                properties: {}
        '400':
          description: '400'
          content:
            application/json:
              examples:
                Result:
                  value: |-
                    {
                        "status": false,
                        "error": {
                            "message": "Hash is not verified",
                            "code": 204
                        }
                    }
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                    example: false
                    default: true
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                        example: Hash is not verified
                      code:
                        type: integer
                        example: 204
                        default: 0
      deprecated: false
      security: []
components:
  securitySchemes:
    sec0:
      type: http
      scheme: basic

````