how to solve the error Unsupported Gateway Type for Storage in whmcs using stripe?

爷,独闯天下 提交于 2020-01-16 08:33:59

问题


I want to save the credit card details for future use and i want to save the data in whmcs database credit card last 4 digit or card_data in blobformat. I am using stripe payment gateway and whmcs.

<?php
$command = 'AddPayMethod';//save the data in api format
$postData = array(
    'clientid' => $ca->getUserID(),//client id
    'type' => 'CreditCard', //credit card type
    'description' => 'Mohit - check',//account holder name
    'card_number' => '4640823519584356',//credit card number
    'card_expiry' => '0521',//credit card expiry date
    'gateway_module_name' => 'stripe'//payment method
);
$adminUsername = '';
$results = localAPI($command, $postData, $adminUsername); //show the api result or error
echo '<pre>';
print_r($results);
echo '</pre>';
?>

回答1:


You haven't used any models, so you won't be able to use $ca->getUserID(). You also need to include WHMCS' init.php file. Try this instead:

<?php

use WHMCS\ClientArea;
require __DIR__ . '/init.php';
$ca = new ClientArea();

$command = 'AddPayMethod';//save the data in api format
$postData = array(
    'clientid' => $ca->getUserID(),//client id
    'type' => 'CreditCard', //credit card type
    'description' => 'Mohit - check',//account holder name
    'card_number' => '4640823519584356',//credit card number
    'card_expiry' => '0521',//credit card expiry date
    'gateway_module_name' => 'stripe'//payment method
);
$adminUsername = '';
$results = localAPI($command, $postData, $adminUsername); //show the api result or error
echo '<pre>';
print_r($results);
echo '</pre>';
?>


来源:https://stackoverflow.com/questions/59589357/how-to-solve-the-error-unsupported-gateway-type-for-storage-in-whmcs-using-strip

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!