Stripe checkout 不接受元数据 [英] Stripe checkout wont accept metadata

查看:27
本文介绍了Stripe checkout 不接受元数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经集成了 Stripe checkout(最新版本)并且需要发送额外的数据,以便我可以协调稍后的网络钩子.

I have integrated Stripe checkout (the latest version) and need to send additional data so I can reconcile a later webhook.

Stripe 拒绝元数据并出现以下错误

Stripe rejects the metadata with the following error

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 一起返回,如 Stripe 文档.

I expect the metadata to be accepted and returned with the webhook, as described in the Stripe documentation.

推荐答案

链接文档的第一句说明:

First sentence of the linked documentation states:

可更新的 Stripe 对象——包括账户、费用、客户、支付意图、退款、订阅和转账——有一个元数据参数.

Updateable Stripe objects—including Account, Charge, Customer, PaymentIntent, Refund, Subscription, and Transfer —have a metadata parameter.

您没有创建任何一个,您正在创建一个会话

You are creating neither of those, you are creating a Session

这篇关于Stripe checkout 不接受元数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆