【问题标题】:javascript stripe add items with ifjavascript带if添加项目
【发布时间】:2020-01-12 18:56:49
【问题描述】:

我似乎无法获得动态创建的项目列表,我想添加其他项目,但前提是值为 true

stripe.redirectToCheckout({
items: [{
    plan: plan, 
    quantity: quantity,
},
{
    plan: 'plan_ddddddd0Hxlu', 
    quantity: aditionalStorageDays,
}],
successUrl: 'https://example.com/success',
cancelUrl: 'https://example.com/cancel',
customerEmail: '<?php echo $userInfo['email']?>',
}).then(function (result) {
// If `redirectToCheckout` fails due to a browser or network
// error, display the localized error message to your customer
// using `result.error.message`.
});

只有在 additionalStorage 为 true 的情况下,我如何添加第二个项目?

{
    plan: 'plan_ddddddd0Hxlu', 
    quantity: aditionalStorageDays,
}

【问题讨论】:

    标签: javascript stripe-payments


    【解决方案1】:

    你能解释一下吗... 你的意思是你想把对象推入数组? 或者您想替换现有对象然后推送新对象?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-11
      • 1970-01-01
      • 1970-01-01
      • 2017-04-26
      相关资源
      最近更新 更多