Last active
November 4, 2016 13:42
-
-
Save Kendysond/6a12a736aeece46c885445534716b994 to your computer and use it in GitHub Desktop.
Sampel request to verify transactions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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