# Vend CableTv

## Cable Tv

<mark style="color:green;">`POST`</mark> `{{base_url}}/cabletv`

#### Headers

| Name                                            | Type   | Description                      |
| ----------------------------------------------- | ------ | -------------------------------- |
| authorization<mark style="color:red;">\*</mark> | String | Set value to `Bearer SECRET_KEY` |

#### Request Body

| Name                                       | Type   | Description                                              |
| ------------------------------------------ | ------ | -------------------------------------------------------- |
| tvno<mark style="color:red;">\*</mark>     | String | Decode IUC number                                        |
| amount<mark style="color:red;">\*</mark>   | String | Amount to buy                                            |
| tv<mark style="color:red;">\*</mark>       | String | e.g GOTV, DSTV, STARTIMES                                |
| custname<mark style="color:red;">\*</mark> | String | Customer name as shown on the verify cable tv response   |
| custno<mark style="color:red;">\*</mark>   | String | Customer number as shown on the verify cable tv response |

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

```javascript
{
  "status": true,
  "message": "Success",
  "txref": "API8650294032c698",
  "charged": 5030,
  "newbal": 100064.8
}
```

{% endtab %}
{% endtabs %}

Take a look at how you might do this:

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

```php
curl --location --request POST 'https://api.oneappgo.com/v1/cabletv' \
--header 'Authorization: Bearer SECRET_KEY' \
--form 'tvno="7528393100"' \
--form 'tv="GOTV"' \
--form 'custname="IBRAHIM MARY OPE"' \
--form 'custno="376946518"' \
--form 'amount="5000"' \
--form 'reference="OI8UYTEFYDTYTG7"'
```

{% endtab %}

{% tab title="NodeJS" %}

```javascript
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://api.oneappgo.com/v1/cabletv',
  'headers': {
    'Authorization': 'Bearer SECRET_KEY'
  },
  formData: {
    'tvno': '7528393100',
    'tv': 'GOTV',
    'custname': 'IBRAHIM MARY OPE',
    'custno': '376946518',
    'amount': '5000',
    'reference': 'OI8UYTEFYDTYTG7'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

```

{% endtab %}

{% tab title="PHP - cURL" %}

```php
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.oneappgo.com/v1/cabletv',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => array('tvno' => '7528393100','tv' => 'GOTV','custname' => 'IBRAHIM MARY OPE','custno' => '376946518','amount' => '5000','reference' => 'OI8UYTEFYDTYTG7'),
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer SECRET_KEY'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.oneappgo.com/v1/cabletv"

payload={'tvno': '7528393100',
'tv': 'GOTV',
'custname': 'IBRAHIM MARY OPE',
'custno': '376946518',
'amount': '5000',
'reference': 'OI8UYTEFYDTYTG7'}
files=[

]
headers = {
  'Authorization': 'Bearer SECRET_KEY'
}

response = requests.request("POST", url, headers=headers, data=payload, files=files)

print(response.text)

```

{% endtab %}

{% tab title="Dart" %}

```dart
var headers = {
  'Authorization': 'Bearer SECRET_KEY'
};
var request = http.MultipartRequest('POST', Uri.parse('https://api.oneappgo.com/v1/cabletv'));
request.fields.addAll({
  'tvno': '7528398333',
  'tv': 'GOTV',
  'custname': 'OLATUNJI OLAJIDE',
  'custno': '176146518',
  'amount': '200',
  'reference': 'OI8UYTEFYDTYTG7'
});

request.headers.addAll(headers);

http.StreamedResponse response = await request.send();

if (response.statusCode == 200) {
  print(await response.stream.bytesToString());
}
else {
  print(response.reasonPhrase);
}

```

{% endtab %}
{% endtabs %}

### Sample Response

```json
{
  "status": true,
  "message": "Success",
  "txref": "API8650294032c698",
  "charged": 5030,
  "newbal": 100064.8
}
```
