PHP

Author: Semaka 51 views
				
					<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://gateway.switch.tj/api/v1/payment-key',
  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 => 'merchant_reference=12312312312&amount=5.00&error_url=https%3A%2F%2Furl-to-your-success-page.co.za&success_url=https%3A%2F%2Furl-to-your-success-page.co.za&cancel_url=https%3A%2F%2Furl-to-your-success-page.co.za&notify_url=https%3A%2F%2Furl-to-your-success-page.co.za&payment_type=credit_card',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Basic V2hvb3NoRGVtb0FQSTpmZGZsa2RmZXVlbzM4Mzk4',
    'Content-Type: application/x-www-form-urlencoded',
    'Cookie: PHPSESSID=abk57kqs42fjpdfvv8a78ckfd7'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;