【发布时间】:2026-02-18 16:20:05
【问题描述】:
也许我有这个错误,但查看文档,我希望客户的电子邮件地址以receipt_email的形式返回,付款时会要求提供此信息,但当前未记录在数据库中,有一个数据库列。
这是创建 Charge 的代码。
def do_transaction(self, token, price, amount, address):
charge = self.stripe_charge(token, price, amount)
txid = coin.sendtoaddress(address, amount)
ret = db.insert('transactions', txid=txid, price=price,
amount=amount, address=address, ip=df.ctx['ip'],
charge_id=charge.id)
self.stripe_finish(charge)
return ret
def stripe_charge(self, token, price, amount):
return stripe.Charge.create(
amount=int(price * 100), currency='usd', card=token,
capture=False, description='%f ArtBytes' % amount)
Charge id 可以通过charge.id 访问,所以我希望收到如下 email=charge.receipt_email 的电子邮件,但没有返回任何内容。没有为费用设置目的地,它可能是receipt_email有效所必需的。
db.insert('transactions', txid=txid, price=price, amount=amount,
address=address, email=charge.receipt_email, ip=df.ctx['ip'], charge_id=charge.id)
我可以从收费对象获取客户电子邮件还是应该以其他方式获取?
API 参考:https://stripe.com/docs/api?lang=python#retrieve_charge
【问题讨论】: