yabacon / paystack-php

A PHP Wrapper for Paystack API - https://www.paystack.com
MIT License
109 stars 70 forks source link

What's the complete proper way to check if BVN is valid or not #23

Open olakunlevpn opened 5 years ago

olakunlevpn commented 5 years ago

What's the complete proper way to check if BVN is valid or not because i have play around with the code and it seems not working

$paystack = new Yabacon\Paystack(Config::get('app.paystack_secret_key'));

try { $responseObj = $paystack->bank->resolveBvn([ 'bvn' => '22395920708', // in kobo ]);

} catch (\Yabacon\Paystack\Exception\ApiException $e) { print_r($e->getResponseObject()); die($e->getMessage()); }

if (http_response_code(200)) { var_dump($responseObj); }

the above code respond on the browser with the following error

stdClass Object ( [status] => [message] => Unable to resolve BVN ) Paystack Request failed with response: 'Unable to resolve BVN'

But we need to check if its valid or not and display some certain error to the user after inserting wrong BVN