【发布时间】:2014-09-24 13:25:05
【问题描述】:
我在使用 Ruby Stripe 集成和 Stripe.js 时遇到卡令牌无法针对客户保存的问题
我们从 Stripe.js 获得看似有效的卡令牌(例如 tok_4VeYrrjJpCwGG6)
然后我打电话给以下;
customer = Stripe::Customer.retrieve(customer_id) #customer_id is correct and valid
customer.card = stripeToken # e.g. the tok_ I gave as an example
customer.save
如果我退出 customer.save 的结果,我会得到类似的结果;
{
"id":"cus_4QR8ZuPUPlgA0G",
"object":"customer",
"created":1405685697,
"livemode":false,
"description":null,
"email":"my_email",
"delinquent":true,
"metadata":{},
"subscriptions": {
"object":"list",
"total_count":0,
"has_more":false,
"url":"/v1/customers/cus_4QR8ZuPUPlgA0G/subscriptions",
"data":[],
"count":0
},
"discount":null,
"account_balance":0,
"currency":"eur",
"cards"{
"object":"list",
"total_count":0,
"has_more":false,
"url":"/v1/customers/cus_4QR8ZuPUPlgA0G/cards",
"data":[],
"count":0
},
"default_card":null,
"subscription":null
}
一切都和我预期的一样,除非卡没有被添加。
谁能告诉我这里可能做错了什么?
【问题讨论】:
标签: ruby stripe-payments