stripe-firebase-extensions
stripe-firebase-extensions copied to clipboard
Store invoice number for reference - (Quick solution)
Feature request
firestore-stripe-invoices
Is your feature request related to a problem? Please describe.
Currently there is no simple way to match a Customer's invoice number to an invoice ID.
If I have the customer email / uid, I can search for all their invoices, and then filter to get one that matches their invoice number, but this is a very long way around.
Describe the solution you'd like
Super simply we just need to add 1 line
stripeInvoiceNumber: finalizedInvoice.number,
to firestore-stripe-invoices/functions/src/index.ts
line 200
Before:
// Write the Stripe Invoice ID back to the document in Cloud Firestore
// so that we can find it in the webhook.
await snap.ref.update({
stripeInvoiceId: finalizedInvoice.id,
stripeInvoiceUrl: finalizedInvoice.hosted_invoice_url,
stripeInvoiceRecord: `https://dashboard.stripe.com${
invoice.livemode ? '' : '/test'
}/invoices/${finalizedInvoice.id}`,
});
After:
// Write the Stripe Invoice ID back to the document in Cloud Firestore
// so that we can find it in the webhook.
await snap.ref.update({
stripeInvoiceId: finalizedInvoice.id,
stripeInvoiceNumber: finalizedInvoice.number,
stripeInvoiceUrl: finalizedInvoice.hosted_invoice_url,
stripeInvoiceRecord: `https://dashboard.stripe.com${
invoice.livemode ? '' : '/test'
}/invoices/${finalizedInvoice.id}`,
});
This is a pretty key field that's just being left out for no reason, it's what the customer sees and needs to be referenced.