我确信我在这里遗漏了一些明显的东西,但是我想不通如何针对客户判断现有的卡.
I'm using the stripe connect api within an laravel app to manage payments on behalf of others, and the basic process is as follows:
- 通过
stripe.js
创建条带token
,并将其与付款表格一起提交 - 如果客户存在于本地数据库中,我将获取他们的
stripe_id
,否则将使用令牌作为源/卡创建一个新客户 - 然后使用检索到的或新的客户
stripe_id
创建charge
目前,如果客户返回并使用另一张卡,因为费用只包括客户,而不包括来源,那么不管怎样,都将从他们的默认卡中收取费用.
What I'd like to do is:
- 创建条带
token
- check
customer
against local database etc - check
card
fingerprint against customer's cards - 如有必要,在客户记录中创建新的
card
- create charge using both
customer
andcard
ids
Simply put:我看不到进程中在哪里生成了持久card_id
;stripe.js
响应中使用的持久化card_id
和在条纹仪表板中创建的持久化card_id
似乎都是唯一的,这意味着每笔费用都会在条纹中创建一个全新的卡对象.
我知道我可以根据客户的帐户检索存储的卡列表-但我从哪里获得要搜索的最初card_id
张卡呢?
I've seen a question that touches on this here - Can I check whether stripe a card is already existed before going to create new one? - but I don't know Ruby, so can't make head nor tail of it.
EDIT:
更简单的版本——有没有一种方法可以在不需要先创建卡片对象的情况下,按照这里的stripe docs(https://stripe.com/docs/api/php#card_object)中的描述获得fingerprint
?