Create the draft invoice first, then attach the line item to that invoice id before finalize. Stripe's current API defaults pending_invoice_items_behavior to exclude, so the old pending-item-then-create-invoice order produced an empty invoice. Finalizing a $0 invoice auto-marks it paid.
If the finalized total does not match amount_cents, void the Stripe invoice and do not store paid. Ignore invoice.paid webhooks whose Stripe total is $0 when the local amount is non-zero.
Test plan
Create a one-off invoice for $2040.00 for a test customer
Confirm the local invoice status is Open and the amount is $2040.00
Open the Stripe hosted invoice and confirm the total is $2040.00 and status is Open, not Paid
Confirm a real invoice.paid webhook still marks a non-zero invoice paid after the customer pays
## Summary
- Closes #33
- Create the draft invoice first, then attach the line item to that invoice id before finalize. Stripe's current API defaults `pending_invoice_items_behavior` to `exclude`, so the old pending-item-then-create-invoice order produced an empty invoice. Finalizing a $0 invoice auto-marks it paid.
- If the finalized total does not match `amount_cents`, void the Stripe invoice and do not store `paid`. Ignore `invoice.paid` webhooks whose Stripe total is $0 when the local amount is non-zero.
## Test plan
- [ ] Create a one-off invoice for $2040.00 for a test customer
- [ ] Confirm the local invoice status is Open and the amount is $2040.00
- [ ] Open the Stripe hosted invoice and confirm the total is $2040.00 and status is Open, not Paid
- [ ] Confirm a real `invoice.paid` webhook still marks a non-zero invoice paid after the customer pays
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
pending_invoice_items_behaviortoexclude, so the old pending-item-then-create-invoice order produced an empty invoice. Finalizing a $0 invoice auto-marks it paid.amount_cents, void the Stripe invoice and do not storepaid. Ignoreinvoice.paidwebhooks whose Stripe total is $0 when the local amount is non-zero.Test plan
invoice.paidwebhook still marks a non-zero invoice paid after the customer pays