gpt4 book ai didi

stripe-payments - 为什么 Stripe checkout Webhooks 将 customer_email 发送到 null?

转载 作者:行者123 更新时间:2023-12-04 00:24:41 29 4
gpt4 key购买 nike

我尝试在 Checkout Stripe 新界面上付款后获取客户电子邮件。 stripe Webhook 发布的 JSON 总是发送带有 null 值的 customer_email。

stripe Checkout 页面要求提供客户电子邮件,所以我不明白为什么 Stripe 会将此值发送回 null。

虽然,客户值(value)不为空。

{
"id": "evt_1FItv8Kj5elW7ZcvEuY6",
"object": "event",
"api_version": "2019-03-14",
"created": 1568539286,
"data": {
"object": {
"id": "cs_test_123123123",
"object": "checkout.session",
"billing_address_collection": null,
"cancel_url": "https://www.example.fr/canceled",
"client_reference_id": null,
"customer": "cus_FoWzBx2yusHfs9",
"customer_email": null,
"display_items": [
{
"amount": 1000,
"currency": "eur",
"quantity": 1,
"sku": {
"id": "sku_1234567",
"object": "sku",
"active": true,
"attributes": {
"name": "Product test"
},
"created": 1568538814,
"currency": "eur",
"image": null,
"inventory": {
"quantity": null,
"type": "infinite",
"value": null
},
"livemode": false,
"metadata": {
},
"package_dimensions": null,
"price": 1000,
"product": "prod_FoWr00dX3",
"updated": 1568538814
},
"type": "sku"
}
],
"livemode": false,
"locale": null,
"mode": "payment",
"payment_intent": "pi_1FItj5elW70Z2",
"payment_method_types": [
"card"
],
"setup_intent": null,
"submit_type": null,
"subscription": null,
"success_url": "https://www.example.fr/success"
}
},
"livemode": false,
"pending_webhooks": 1,
"request": {
"id": null,
"idempotency_key": null
},
"type": "checkout.session.completed"
}

最佳答案

客户输入的电子邮件实际上位于 CheckoutSession 链接到的 Customer 对象上。 [0] customer_email 字段是其他字段(您的代码可能已将此字段设置为将电子邮件预填充到 session 中)。

因此,从 API (cus_FoWzBx2yusHfs9) 检索客户对象并检查那里的 email 字段;或检索 Session 对象和 expand the Customer field.

[0] - https://stripe.com/docs/api/customers/object#customer_object-email

关于stripe-payments - 为什么 Stripe checkout Webhooks 将 customer_email 发送到 null?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57943676/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com