Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.