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

# Purchase Cable TV

> Purchase a subscription for Cable TV

## Overview

Purchase a subscription package for a validated Cable TV smartcard. The subscription will be activated instantly.

## Request Body

<RequestField name="smartcard" type="string" required>
  Validated customer smartcard or IUC number.
</RequestField>

<RequestField name="provider" type="string" required>
  Cable TV provider from the cable TV catalog.
</RequestField>

<RequestField name="bouquetCode" type="string" required>
  Package `productCode` from the cable TV catalog.
</RequestField>

<RequestField name="amount" type="number" required>
  Package amount in Naira.
</RequestField>

<RequestField name="phone" type="string" required>
  Customer phone number for the transaction.
</RequestField>

## Response Fields

<ResponseField name="requestReference" type="string">
  Reference to store for reconciliation, support, and requerying pending transactions.
</ResponseField>

<ResponseField name="smartcard" type="string">
  Smartcard number for the completed purchase.
</ResponseField>

<ResponseField name="provider" type="string">
  Cable TV provider for the completed purchase.
</ResponseField>

<ResponseField name="bouquet" type="string">
  Purchased package name, when available.
</ResponseField>

<ResponseField name="amount" type="number">
  Package amount, in Naira.
</ResponseField>

<ResponseField name="commission" type="number">
  Commission earned on the purchase, in Naira.
</ResponseField>

## Status Codes

| Code  | Meaning                                                                                                                                                                                          |
| ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `200` | Subscription completed successfully. Package details are returned in `data`.                                                                                                                     |
| `202` | Subscription accepted but not yet confirmed. Wait at least 2 minutes, then call [Requery Transaction](/api-reference/endpoint/requeryvendingtransaction) to confirm the final status.            |
| `400` | The request could not be processed. Common causes: invalid payload, insufficient balance, or the purchase was declined by the provider. If the wallet was debited, it is automatically refunded. |

## Notes

* Validate the smartcard before purchase and let the customer confirm the returned details.
* Use the `productCode` from the cable TV catalog as `bouquetCode`.
* Use the package amount returned by the catalog.
* If the API returns `gatewayStatus: "01"` or an accepted pending response, wait at least 2 minutes before calling [Requery Transaction](/api-reference/endpoint/requeryvendingtransaction).


## OpenAPI

````yaml POST /purchaseCableTV
openapi: 3.0.3
info:
  title: Bleeprs API Specification 0.1
  version: 1.0.0
  contact: {}
servers:
  - url: https://api.bleeprs.com/api
security:
  - bearerAuth: []
paths:
  /purchaseCableTV:
    post:
      tags:
        - Vending
      summary: Purchase Cable TV
      description: Purchase a cable TV subscription for a validated smartcard.
      operationId: purchaseCableTV
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                amount:
                  type: number
                  description: Package amount returned by the CableTVList endpoint
                  example: 15700
                smartcard:
                  type: string
                  description: The validated customer smartcard or IUC number
                  example: '8093245829'
                phone:
                  type: string
                  description: The customer phone number
                  example: '08000000000'
                provider:
                  type: string
                  description: The Cable TV provider
                  example: DSTV
                bouquetCode:
                  type: string
                  description: Product code returned by the CableTVList endpoint
                  example: DSTV_PACKAGE_CODE
              required:
                - amount
                - smartcard
                - phone
                - provider
                - bouquetCode
      responses:
        '200':
          description: Successfully Processed
          content:
            application/json:
              schema:
                type: object
                properties:
                  gatewayStatus:
                    type: string
                    example: '00'
                  gatewayMessage:
                    type: string
                    example: Successfully Processed
                  requestReference:
                    type: string
                    example: bpr_req_a1b2c3d4e5f6
                  data:
                    type: object
                    properties:
                      smartcard:
                        type: string
                        example: '8093245829'
                      provider:
                        type: string
                        example: DSTV
                      bouquet:
                        type: string
                        example: DSTV Compact
                      amount:
                        type: number
                        example: 15700
                      commission:
                        type: number
                        example: 150
        '202':
          description: Transaction Pending
          content:
            application/json:
              schema:
                type: object
                properties:
                  gatewayStatus:
                    type: string
                    example: '01'
                  gatewayMessage:
                    type: string
                    example: Transaction Pending
                  requestReference:
                    type: string
                    example: bpr_req_a1b2c3d4e5f6
                  data:
                    type: object
                    nullable: true
                    description: >-
                      No additional data is returned while the transaction is
                      pending.
        '400':
          description: >-
            The request could not be processed. Common causes: invalid payload,
            insufficient balance, or the purchase was declined by the provider.
            If the wallet was debited, it is automatically refunded.
          content:
            application/json:
              schema:
                type: object
                properties:
                  gatewayStatus:
                    type: string
                    example: '88'
                  gatewayMessage:
                    type: string
                    example: Unsucessfull
                  requestReference:
                    type: string
                    example: bpr_req_a1b2c3d4e5f6
                  data:
                    type: string
                    example: No active NGN vending account found
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````