[英]Capturing the customers email from Stripe
Perhaps I have this wrong but looking at the documentation I expect the customers email address to be returned as receipt_email, this information is asked for when paying but it is not currently logged in the DB, there is a DB column for it. 也许我有这个错误,但是在查看文档时,我希望客户的电子邮件地址将以receive_email的形式返回,在付款时会要求提供此信息,但该信息当前未登录到DB中,其中有一个DB列。
Here is the code to create a 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)
The Charge id is accessible with charge.id so I hoped to get the email with email=charge.receipt_email as below but nothing is returned. Charge ID可通过charge.id访问,因此我希望获得如下所示的电子邮件,其中email = charge.receipt_email,但未返回任何内容。 No destination is set for the charge and it could be that is required for receipt_email to be valid.
没有设置收费目的地,可能是收据_电子邮件有效所必需的。
db.insert('transactions', txid=txid, price=price, amount=amount,
address=address, email=charge.receipt_email, ip=df.ctx['ip'], charge_id=charge.id)
Can I get the customers email from the charge object or should I get it another way? 我可以从收费对象中获取客户的电子邮件,还是应该以其他方式获取?
API Reference: https://stripe.com/docs/api?lang=python#retrieve_charge API参考: https : //stripe.com/docs/api?lang = python#retrieve_charge
In order for Stripe to send an email receipt , one of the following conditions must be met: 为了让Stripe发送电子邮件回执 ,必须满足以下条件之一:
you created the charge with a customer ID in the customer
parameter, AND this customer has a valid email address in its email
attribute, AND you've checked the "Email customers for successful payments" box in your account settings 您使用
customer
参数中的客户ID 创建了费用 ,并且该客户在其email
属性中具有有效的电子邮件地址,并且您在帐户设置中选中了“为成功付款的客户email
电子邮件”框
you created the charge with a valid email address in the receipt_email
parameter 您使用
receipt_email
参数中的有效电子邮件地址创建了费用
From the code you shared, neither condition is met (your charge creation request parameters do not include either a customer
or a receipt_email
parameter), so Stripe has no way of knowing the customer's email address and sending a receipt. 从您共享的代码来看,都不满足任何条件(您的费用创建请求参数既不包含
customer
也不包含receipt_email
参数),因此Stripe无法知道客户的电子邮件地址并发送收据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.