【发布时间】:2020-10-19 21:49:06
【问题描述】:
我正在尝试弄清楚如何将元数据直接存储到 Stripe CC 支付订阅中。我正在使用 PHP SDK 并且拥有:
$test = $stripe->checkout->sessions->create([
'customer_email' => $_GET["who"],
'success_url' => $success_url,
'payment_method_types' => ['card'],
'cancel_url' => "https://www.example.com",
'line_items' => [
[
'price' => $price_plan_id,
'quantity' => 1,
],
],
'payment_intent_data' => [
'metadata' => [
'who' => $_GET["who"],
'total' => $_GET["total"],
'period' => $_GET["period"],
'description' => $_GET["description"],
'district' => $_GET["district"],
'what' => $_GET["what"],
'ip' => $_SERVER["REMOTE_ADDR"]
]
],
'mode' => $mode 'subscription',
]);
这给了我一个错误:
你不能在
subscription模式下通过payment_intent_data。
我已经尝试过:
$test = $stripe->checkout->sessions->create([
'customer_email' => $_GET["who"],
'success_url' => $success_url,
'payment_method_types' => ['card'],
'cancel_url' => "https://www.example.com",
'line_items' => [
[
'price' => $price_plan_id,
'quantity' => 1,
],
],
'metadata' => [
'who' => $_GET["who"],
'total' => $_GET["total"],
'period' => $_GET["period"],
'description' => $_GET["description"],
'district' => $_GET["district"],
'what' => $_GET["what"],
'ip' => $_SERVER["REMOTE_ADDR"]
],
'mode' => $mode 'subscription',
]);
虽然它有点工作,但它没有分配给订阅(当你查看它时,元数据是空的)
我该如何传递这个?我想将此数据保存在订阅元素中(不仅仅是付款)
谢谢
【问题讨论】:
标签: stripe-payments