我想保存信用卡详细信息以备将来使用,我想将数据保存在whmcs数据库信用卡的最后4位数字或card_data中。我正在使用条纹支付网关和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>';
?>
您尚未使用任何模型,因此将无法使用$ca->getUserID()
。您还需要包括WHMCS的init.php文件。请尝试以下方法:
<?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>';
?>