我遇到一个错误:
客户cus_EmVoBWWrqnWw4W没有ID为tok_1EIw1gKIAV9zC39qQnFXKzi6的链接源。
这是我的代码:
\Stripe\Stripe::setApiKey("sk_test_rUFQ9fpJoK9TlRVJs1nSYd6C");
$user = new User();
$email = $user->getEmail();
//creation du client
$customer = \Stripe\Customer::create(array(
"email" => $email,
));
$charge = \Stripe\Charge::create(array(
"amount" => 2000,
"currency" => "eur",
"source" => $request ->request->get('stripeToken'),
"description" => "Stripe connect - Order 36",
"customer" => $customer->id
));
\Stripe\Stripe::setApiKey("sk_test_rUFQ9fpJoK9TlRVJs1nSYd6C");
$refund = \Stripe\Refund::create([
'charge' => $charge,
'amount' => 1000,
]);
答案 0 :(得分:0)
您需要save the card to the customer,然后向客户收费。之后,除非客户有多个来源,并且您要使用特定来源,否则您无需将source
传递给Charge::create
。