Pay TV

This is method is used to complete a Pay TV Subscription

This API supports 5 Local Pay TV Providers i.e GOTV,DSTV,AZAM TV, ZUKU TV and START TIMES

Request Type

POST

General Payload


  // Sample PHP pay Load

  $live_url = "https://silicon-pay.com/pay_tv";
  $test_url = "https://silicon-pay.com/test/pay_tv";
  

  $data_req = [
    "smart_card_number"=>"Customer Reference/ Account Number/ Smart Card  Number",
    "emailAddress"=>"User Email Address",
    "phone"=> "User Phone Number",
    "encryption_key"=>"Account Encryption Key",
    "amount"=>"Package Amount got from Pay TV Tariffs",
    "call_back"=> "Success callback URL",
    "payment_code"=> "Package Payment Code got from Query Pay Tv Tariffs",
    "txRef"=>"Unique Transaction Reference ("txRef") got from Query PayTv Customer Details",
    "request_ref": Unique Request  reference  ("request_reference") got from Querying PayTV Customer Details
];
// Now Generate the signature. 
$secrete_key ="XXXX";
$encryption_key = "XXXXX";
$phone_number = "XXXX";

$msg	=	hash('sha256',$encryption_key).$phone_number;

$signature	= hash_hmac('sha256',$msg, $secrete_key);
  
$headers  = [
  "signature:". $signature,
  'Content-Type: application/json'
];

$curl = curl_init();

curl_setopt_array($curl, array(
  //Use live url ($live_url) when in production. 
  CURLOPT_URL => $test_url,
  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 =>json_encode( $data_req),
  CURLOPT_HTTPHEADER => $headers,
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

Test Smart Card Numbers

DSTV: 7034691730

GOTV: 7023864752

STARTIMES: 01819767658

ZUKU: 609957

Parameter Description

# Parameter Description
1 smart_card_number, Customer Reference/ Account Number/ Smart Card Number
2 emailAddress Email Address of the user
3 phone Phone Number of the user
4 encryption_key Account Encryption Key
5 amount Package Amount got from Query Pay TV Tariffs. This amount is usually the price of the package got from query tariffs end point except for Zuku TV where the customer needs to provide the amount
6 call_back URL where a callback IPN shall be sent
7 txRef Unique Transaction Reference ("txRef") got from Query PayTv Customer Details
8 request_ref Request reference passed when Querying PayTV Customer Details

Success Response

When all the payload parameters are correct


{"status":200,"message":"Pay TV transaction accepted."}

Failure Response

When there is an issue with the network or when something is not right, you shall get a failed notification


{
"status":201,
"message":"Pay pay transaction failed.",
"description": "XXXXXX"
}

CallBack/ IPN Notification

Once the transaction has been succeefully proceessed, An IPN is sent back to your provided call back URL.


{
      'code'=>200,
      'status'=>'success',
      'txRef':"XXXXX",
      'amount':"XXXXX",
      'charge':"XXXXXX" ,
      'type'=>"PAY TV",
      'secure_hash'=>"XXXX"
}

Recieve IPN/Call Back

A secure hash is sent with the call back data. This is to help you confirm that the call back came from us.


// Recieve IPN. 

$body = file_get_contents("php://input");
$dataObject = json_decode($body);

$reference = $dataObject->txRef;
$secure_hash = $dataObject->secure_hash;
$secrete_key ="Enter your account Secrete key";

// Generate a secure hash on your end.
  $cipher = 'aes-256-ecb';
	$generated_hash = openssl_encrypt($reference, $cipher, $secrete_key);
  
  if($generated_hash == $secure_hash){
    // The call back came from us. 
    // Give value to your customers.
  }