我遇到了Wepay API的问题。我的代码是正确的,但它一直返回错误,说“付款方式不存在或不属于应用程序”。我已经配置了允许标记化信用卡的权限。但仍然。任何反馈都非常感谢。谢谢!
这是我的代码
require_once('public/payment/wepay/wepay.php');
$user = API::get_client(['fldClientEmail' => $email])->first();
// change to useProduction for live environments
\Wepay::useStaging(WEPAY_CLIENT_ID, WEPAY_CLIENT_SECRET);
$wepay = new \WePay($user->fldClientWepayTokenAccess);
// $wepay = new \WePay(WEPAY_ACCESS_TOKEN);
// dd($email);die;
// dd($user->fldClientWepayAccountID);die;
// charge the credit card
$response = $wepay->request('checkout/create', [
'account_id' => $user->fldClientWepayAccountID,
'amount' => number_format(Input::get('amount_tipped'),2),
'currency' => 'USD',
'short_description' => 'A short description',
'type' => 'goods',
'payment_method' => array(
'type' => 'credit_card',
'credit_card' => array(
'id' => Input::get('cc_id')
)
)
]);
// display the response
return $response;
答案 0 :(得分:0)
请确保当您按照他们的文档中的指南进行操作时,请替换示例中的所有凭据。我正在使用他们提供的 client_id
用他们的Javascript库对信用卡进行标记化。
response = WePay.credit_card.create({
"client_id": YOUR.CLIENT.ID.HERE,
"user_name": valueById('name'),
"email": valueById('email'),
"cc_number": valueById('cc-number'),
"cvv": valueById('cc-cvv'),
"expiration_month": valueById('cc-month'),
"expiration_year": valueById('cc-year'),
"address": {
"postal_code": valueById('postal_code')
}
如果您不提供自己的信用卡,就好像您是在为非您的另一个应用程序创建信用卡一样。
如果这不能解决问题,请查看这篇文章,希望可以做到:
https://support.wepay.com/hc/en-us/articles/203609273-WePay-API-Error-Codes