Skip to content

Instantly share code, notes, and snippets.

@Kendysond
Last active November 4, 2016 13:42
Show Gist options
  • Save Kendysond/6a12a736aeece46c885445534716b994 to your computer and use it in GitHub Desktop.
Save Kendysond/6a12a736aeece46c885445534716b994 to your computer and use it in GitHub Desktop.
Sampel request to verify transactions
$code = '1212ujwq';
header( 'HTTP/1.1 200 OK' );
$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"Authorization: Bearer sk_test_877a9699bbc3cf8e42f2190f1b39e35e974d5e2d\r\n"
)
);
$context = stream_context_create($opts);
$url = 'https://api.paystack.co/transaction/verify/'.$code;
$request = file_get_contents($url, false, $context);
$result = json_decode($request);
if ($result->data->status == "success") {
$paid = $result->data->amount/100;
if ($booking->totalprice == $paid) {
}
}else{
redirect(base_url('payment/failed'));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment