首页 文章

条带 - 在用户上存储多个源

提问于
浏览
2

我试图在单个用户对象上存储多个源(卡) .

假设我有一个客户已经存储了一个源 .

使用新的源令牌,然后执行以下操作

stripe.customers.update(customer, {source:call.request.source}, function(err, updatedCustomer){
     if(err){
         return console.log(err);
     }
     console.log(updatedCustomer.sources.data);     
})

当我这样做时,客户现有的源丢失并且存储新的源 .

如何在同一客户上存储多个来源?

2 回答

  • 2

    使用createSource而不是更新完成技巧 .

    stripe.customers.createSource(customer, {source:call.request.source}, function(err, updatedCustomer){
       if(err){
         return console.log(err);
       }
       console.log(updatedCustomer.sources.data);     
    })
    
  • 0

    这对你有用 .

    customer = Stripe :: Customer.retrieve(stripe_customer_id)

    customer.sources.create(stripeToken)

    使用stripe.js生成条带标记 .

相关问题