我一直在尝试创建一个付款的结帐会话,应该在连接的帐户。每当我尝试使用下面的代码创建会话时,我都会得到InvalidRequestException
表示Invalid array
StripeStripe::setApiKey(env('STRIPE_SECRET'));
$stripe = new StripeStripeClient(env('STRIPE_SECRET'));
$session = StripeCheckoutSession::create([
'payment_method_types' => ['card'],
'line_items' => [
'price_data' => [
'unit_amount' => 25000,
'currency' => 'usd',
'product_data' => ['name' => 'Product8', 'active' => true],
],
'quantity' => 2,
],
'mode' => 'payment',
'success_url' => 'http://devweb.drivinggradebook.com/',
'cancel_url' => 'https://www.drivinggradebook.com/',
'payment_intent_data' => [
'application_fee_amount' => 10,
],
], ['stripe_account' => 'acct_1L7ugjSJzLhcy6eF']);
请帮我一下,由于
在我的例子中,我用laravel 8.75和stripe/stripe-php 10.1运行它
public function checkout(Request $request)
{
StripeStripe::setApiKey(STRIPE_SECRET);
header('Content-Type: application/json');
$checkout_session = StripeCheckoutSession::create([
'line_items' => [
[
'price_data' => [
'currency' => 'eur',
'product_data' => [
'name' => 'Home'
],
'unit_amount' => 500
],
'quantity' => 1
],
],
'mode' => 'payment',
'success_url' => url("/stripe_success?session_id={CHECKOUT_SESSION_ID}&tenant_id=$request->id"),
'cancel_url' => route('payments.index'),
]);
return redirect()->away($checkout_session->url);
}