sev*_*een 10 php stripe-payments
我已经集成了 Stripe checkout(最新版本)并且需要发送额外的数据,以便我可以协调稍后的 webhook。
Stripe 拒绝元数据并出现以下错误
Fatal error: Uncaught exception 'Stripe\Error\InvalidRequest' with message 'Received unknown parameter: metadata'
Run Code Online (Sandbox Code Playgroud)
我部分编辑的代码如下所示
$object = \Stripe\Checkout\Session::create([
'success_url' => 'www/payment_processor.php?action=success',
'cancel_url' => 'www/payment_processor.php?action=cancel',
'payment_method_types' => ['card'],
'customer_email' => $email,
'metadata' => ['user_id' => $user_id],
'line_items' => [[
'amount' => $amount,
'currency' => $currency,
'name' => 'Purchase',
'description' => $description,
'quantity' => 1,
]]
]);
Run Code Online (Sandbox Code Playgroud)
我希望元数据被接受并与 webhook 一起返回,如Stripe 文档中所述。
对于仍然遇到此问题的任何人,即使使用 2020-08-27 API ,仅放置一个client_reference_idormetadata参数对我也不起作用。
添加payment_intent_data元数据是让它为我工作的原因。您可以尝试添加以下代码:
'payment_intent_data'=>['metadata' => ["order_id" => $orderID, "type" => "myProduct"],
Run Code Online (Sandbox Code Playgroud)
小智 6
你可以这样做
stripe.checkout.sessions.create({
payment_intent_data: {
application_fee_amount: this.booking_fee,
metadata: {
key1 : value1,
key2 : value2,
.
.
key N : value N
}
}
})
Run Code Online (Sandbox Code Playgroud)
截至 2020 年 10 月,会话对象具有元数据。
| 归档时间: |
|
| 查看次数: |
5149 次 |
| 最近记录: |