Stripe payment error : Invalid string id
Stripe payment error : Invalid string id
创建 Stripe Charge 时出现以下错误
Invalid string id: {"number"=>"401288******1881", "exp_month"=>"02",
"exp_year"=>"2015", "cvc"=>"***", "name"=>"Tahir Yasin",
"address_line1"=>"lorem ipsum dolar", "address_line2"=>"lorem ipsum
dolar", "address_zip"=>"5400", "address_state"=>"Punjab",
"address_country"=>"PK"}{"success":true,"error":false}
条纹费用和代收费用
try {
$charge = Stripe_Charge::create(array(
'amount' => 500,
'currency' => 'usd',
'card' => array(
'number' => '4012888888881881',
'exp_month' => '02',
'exp_year' => '2015',
'cvc' => '123',
'name' => 'Tahir Yasin',
'address_line1' => 'lorem ipsum dolar',
'address_line2' => 'lorem ipsum dolar',
'address_zip' => '5400',
'address_state' => 'Punjab',
'address_country' => 'PK',
),
'description' => '#100000011, tahiryasin@test.com',
"application_fee" => 5
), 'SECRET_KEY_OF_CUSTOMER_TAKEN_VIA_STRIPE_CONNECT'
);
} catch (Exception $e) {
echo $e->getMessage();
}
进一步挖掘堆栈跟踪显示
[error] => Array
(
[type] => invalid_request_error
[message] => Invalid string id: {"number"=>"401288******1881", "exp_month"=>"02", "exp_year"=>"2015", "cvc"=>"***", "name"=>"Tahir Yasin", "address_line1"=>"lorem ipsum dolar", "address_line2"=>"lorem ipsum dolar", "address_zip"=>"5400", "address_state"=>"Punjab", "address_country"=>"PK"}
[param] => card
)
我认为这可能是由于虚拟卡详细信息造成的,但我输入了我的真实卡详细信息,但仍然出现同样的错误。
任何人都可以查看并让我知道我在这里缺少什么吗?
发生这种情况是因为您在使用 Stripe Connect 创建费用时无法通过 API 直接提供银行卡详细信息。您必须先用 Stripe Checkout or Stripe.js 创建一个令牌,然后使用此卡令牌创建费用。
根据 documentation:
Note that we require Stripe.js for all applications—you won't be allowed to send credit card data directly from your server.
创建 Stripe Charge 时出现以下错误
Invalid string id: {"number"=>"401288******1881", "exp_month"=>"02", "exp_year"=>"2015", "cvc"=>"***", "name"=>"Tahir Yasin", "address_line1"=>"lorem ipsum dolar", "address_line2"=>"lorem ipsum dolar", "address_zip"=>"5400", "address_state"=>"Punjab", "address_country"=>"PK"}{"success":true,"error":false}
条纹费用和代收费用
try {
$charge = Stripe_Charge::create(array(
'amount' => 500,
'currency' => 'usd',
'card' => array(
'number' => '4012888888881881',
'exp_month' => '02',
'exp_year' => '2015',
'cvc' => '123',
'name' => 'Tahir Yasin',
'address_line1' => 'lorem ipsum dolar',
'address_line2' => 'lorem ipsum dolar',
'address_zip' => '5400',
'address_state' => 'Punjab',
'address_country' => 'PK',
),
'description' => '#100000011, tahiryasin@test.com',
"application_fee" => 5
), 'SECRET_KEY_OF_CUSTOMER_TAKEN_VIA_STRIPE_CONNECT'
);
} catch (Exception $e) {
echo $e->getMessage();
}
进一步挖掘堆栈跟踪显示
[error] => Array
(
[type] => invalid_request_error
[message] => Invalid string id: {"number"=>"401288******1881", "exp_month"=>"02", "exp_year"=>"2015", "cvc"=>"***", "name"=>"Tahir Yasin", "address_line1"=>"lorem ipsum dolar", "address_line2"=>"lorem ipsum dolar", "address_zip"=>"5400", "address_state"=>"Punjab", "address_country"=>"PK"}
[param] => card
)
我认为这可能是由于虚拟卡详细信息造成的,但我输入了我的真实卡详细信息,但仍然出现同样的错误。
任何人都可以查看并让我知道我在这里缺少什么吗?
发生这种情况是因为您在使用 Stripe Connect 创建费用时无法通过 API 直接提供银行卡详细信息。您必须先用 Stripe Checkout or Stripe.js 创建一个令牌,然后使用此卡令牌创建费用。
根据 documentation:
Note that we require Stripe.js for all applications—you won't be allowed to send credit card data directly from your server.