【发布时间】:2019-09-08 16:14:47
【问题描述】:
我已经集成了 Stripe 结账(最新版本),需要发送额外的数据,以便我可以协调以后的 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,
]]
]);
如Stripe documentation 中所述,我希望元数据被接受并与 webhook 一起返回。
【问题讨论】:
-
我遇到了类似的问题。能够为项目添加某种 ID 会很方便。
-
最后我添加了属性 - client_reference_id 并使用了逗号分隔的值列表。唯一的问题是 client_reference_id 仅针对已完成的结帐会话返回,而不是收费成功事件。
标签: php stripe-payments