DEV Community

Discussion on: How to Integrate Paystack payment system

Collapse
 
holynation profile image
Alatise Oluwaseun • Edited

Good afternoon @ijsucceed .
I really love your code for it simplicity. However, i did love to make some corrections starting with the initialize.php.
// this part of the code is wrong since an array is returned, so it should not be
if(!$tranx->status){
// there was an error from the API
print_r('API returned error: ' . $tranx['message']);
}
// the corrected version
if(!$tranx['status']){
print_r('API returned error: ' . $tranx['message']);
}
Thank you.

Collapse
 
ijsucceed profile image
Jeremy Ikwuje

You're right @holynation .

I just ran some few tests. The actual issue came from the Paystack documentation.

Though it will be hard for one to notice ( including Paystack developers) since the page gets redirected to the checkout form.

header('Location: ' . $tranx['data']['authorization_url']);

Thanks.

Collapse
 
holynation profile image
Alatise Oluwaseun

That is true. I have actually been looking for that too in their documentation.
Also i wanna ask again, how do i send phone number and fullname along side the initialize.php api