我已经集成了 Stripe checkout(最新版本),并且需要发送额外的数据,以便我可以协调以后的 webhook。
Stripe 拒绝元数据并出现以下错误
Fatal error: Uncaught exception 'Stripe\Error\InvalidRequest' with message 'Received unknown parameter: metadata'
我部分编辑的代码如下所示
$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,
]]
]);
我希望元数据能够被接受并通过 webhook 返回,如条纹文档 https://stripe.com/docs/api/metadata.
对于仍然遇到此问题的任何人,只需放置一个client_reference_id
or metadata
即使使用 2020-08-27 API,参数也对我不起作用。
Adding payment_intent_data
元数据让它对我有用。您可以尝试添加以下代码:
'payment_intent_data'=>['metadata' => ["order_id" => $orderID, "type" => "myProduct"],
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)