脚本宝典收集整理的这篇文章主要介绍了在php中集成payfort api的问题,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
我在Api中使用以下代码:
<?PHP require_once('lib/Start.PHP'); // Enter secret key here Start::setApiKey('test_sec_k_9d19ef5bd543507e333ba7b'); //Create a new token for customer $token = Start_Token::create(array( "number" => "4242424242424242","exp_month" => 06,"exp_year" => 2018,"cvc" => "123","name" => "Abdullah Mohammed" )); echo "<PRe>"; print_r($token); exIT; $result = Start_Charge::create(array( "amount" => 1000,"currency" => "aed","Metadata" => array( "reference_id" => "1234567890","tag" => "new" ),"card" => array( "name" => "Abdullah Ahmed","number" => "4242424242424242","cvc" => "123" ),"description" => "Two widgets (test@example.COM)","email" => "abc@gmail.com" )); try { // Use Start's bindings... } catch(Start_Error_Banking $e) { // Since it's a decline,Start_Error_Banking will be caught print('status is:' . $e->getHttpStatus() . "\n"); print('Code is:' . $e->getErrorCode() . "\n"); print('Message is:' . $e->getMessage() . "\n"); } catch (Start_Error_Request $e) { // Invalid parameters were supplied to Start's API } catch (Start_Error_Authentication $e) { // Invalid API key } catch (Start_Error_Processing $e) { // Something wrong on Start's end } catch (Start_Error $e) { // Display a very generic error to the user,and maybe send // yourself an email } catch (Exception $e) { // Something else hapPEned,completely unrelated to Start } ?>
在上面的代码中,我使用了print_r()并退出来打印变量的详细信息,但是我得到了如下错误:
<b>Fatal error</b>: Uncaught exception 'Start_Error_Authentication' with message 'Request can only be authenticated with an open API Key.'
请帮我解决这个问题.
提前感谢您的关注.
以上是脚本宝典为你收集整理的在php中集成payfort api的问题全部内容,希望文章能够帮你解决在php中集成payfort api的问题所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。