Skip to content

Commit 78b9a2d

Browse files
committed
Invoice: Add customer_email in invoice object
[Stripe documentation on invoices] describes this field like this: > customer_email - nullable string > > The customer’s email. Until the invoice is finalized, this field will equal > customer.email. Once the invoice is finalized, this field will no longer be > updated. This is the field that should be used to know where an invoice was effectively sent (when using Stripe or a third-party solution to send invoices by email) Note that the current implementation only updates the field on invoice finalization to keep the implementation simple. [Stripe documentation on invoices]: https://docs.stripe.com/api/invoices/object#invoice_object-customer_email
1 parent fdbe945 commit 78b9a2d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

localstripe/resources.py

+3
Original file line numberDiff line numberDiff line change
@@ -1208,6 +1208,7 @@ def __init__(self, customer=None, subscription=None, metadata=None,
12081208
super().__init__()
12091209

12101210
self.customer = customer
1211+
self.customer_email = cus.email
12111212
self.subscription = subscription
12121213
self.tax_percent = tax_percent
12131214
self.default_tax_rates = default_tax_rates
@@ -1334,6 +1335,8 @@ def charge(self):
13341335
def _finalize(self):
13351336
assert self.status == 'draft'
13361337
self._draft = False
1338+
cus = Customer._api_retrieve(self.customer)
1339+
self.customer_email = cus.email
13371340
self.status_transitions['finalized_at'] = int(time.time())
13381341

13391342
def _on_payment_success(self):

0 commit comments

Comments
 (0)