Skip to content

Commit 46cfef8

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 46cfef8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

localstripe/resources.py

+2
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,7 @@ def charge(self):
13341335
def _finalize(self):
13351336
assert self.status == 'draft'
13361337
self._draft = False
1338+
self.customer_email = Customer._api_retrieve(self.customer).email
13371339
self.status_transitions['finalized_at'] = int(time.time())
13381340

13391341
def _on_payment_success(self):

0 commit comments

Comments
 (0)