我有一系列客户,我想对其进行批量收费。有时由于网络的原因,有些费用没有通过,而有些则因此提出新的请求再次向所有客户收费。我读到我可以使用幂等性,但注意到每次发出请求时密钥都会重新生成。我如何实现生成密钥来识别每个用户而不将密钥存储在数据库中,因为它是一个临时密钥?
for(customer in customers){
stripe.charges.create({
amount: 2000,
currency: "usd",
source: token,
customer: stripe_customerId,
}, {
idempotency_key: uuid
}, function(err, charge) {
// asynchronously called
});
}
Run Code Online (Sandbox Code Playgroud)
请对此有任何想法吗?