我正在使用stripe gateway和他们最新的php-api:
StripeStripe::setApiKey($stripe['secret_key']);
try {
//Create a token
$token = StripeToken::create(array("card" => array(
"name" => Client Name",
"number" => 4242424242424242,
"exp_month" => 12,
"exp_year" => 2018,
"cvc" => 123,
)));
//Create a client
$client = StripeCustomer::create(array(
"description" => "John Doe",
"source" => $token['id'],
));
//Charge client
$charge = StripeCharge::create(array(
"amount" => round(1.99 * 100, 0),
"currency" => "USD",
"customer" => $client['id'],
"description" => "Membership Access"
));
}
catch (StripeErrorCard $e) {
$e->getJsonBody();
}
一切都很好,客户端在我的条纹仪表板中创建,费用也在那里,但我一直收到警告:urlender()希望参数1是字符串,对象在\lib\HttpClient\CurlClient.php的292行
这可能是由于传递对象作为customer
参数而不是字符串ID。