问题
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