-
Notifications
You must be signed in to change notification settings - Fork 126
feat: Void and generate credit notes #3748
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
floganz
reviewed
Jun 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good but I think we miss a lot of tests for these changes.
e94b60c
to
5958476
Compare
vincent-pochet
approved these changes
Jun 10, 2025
2f8512e
to
89973c2
Compare
diegocharles
approved these changes
Jun 10, 2025
diegocharles
added a commit
that referenced
this pull request
Jul 11, 2025
## Context This PR extends the invoice voiding logic to support optional credit note generation, with refund and credit amounts. Originally, a `confirm_void` parameter was proposed to make the override explicit. After internal discussion, we decided to simplify the API: the presence of `generate_credit_note` is now considered an explicit intent to force the void. This change preserves backwards compatibility while unlocking more powerful workflows. ## Description This pr adds support for the following parameters in the void_invoice mutation and endpoint: ``` json { "generate_credit_note": true, "refund_amount": 2000, "credit_amount": 1150 } ``` If no parameters are passed → invoice must be voidable (as before). If generate_credit_note parameter is passed → invoice is voided ( all types of invoices can now be voided ) **Partial Credit Note + Remaining Voided Credit** When a credit note is generated with a refund_amount and/or credit_amount that does not cover the full invoice amount, the system will: 1. Generate a first credit note with the specified refund_amount and credit_amount. 2. Automatically generate a second credit note for the remaining amount, which is immediately voided. This ensures that: - The entire invoice amount is covered across the two credit notes. - Only the explicitly requested amounts are usable (refunded or credited). - The remaining amount is voided and not usable by the customer, but still bookkept for completeness and compliance. Example Invoice total: €20 (2000 cents) Request: ``` json { "generate_credit_note": true, "refund_amount": 1000, "credit_amount": 500 } ``` The system will create: ✅ Credit Note 1: €10 refunded + €5 credited (usable) 🚫 Credit Note 2: €5 voided (not usable) --------- Co-authored-by: Diego Charles <diegocharles@me.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
This PR extends the invoice voiding logic to support optional credit note generation, with refund and credit amounts.
Originally, a
confirm_void
parameter was proposed to make the override explicit. After internal discussion, we decided to simplify the API: the presence ofgenerate_credit_note
is now considered an explicit intent to force the void.This change preserves backwards compatibility while unlocking more powerful workflows.
Description
This pr adds support for the following parameters in the void_invoice mutation and endpoint:
If no parameters are passed → invoice must be voidable (as before).
If generate_credit_note parameter is passed → invoice is voided ( all types of invoices can now be voided )
Partial Credit Note + Remaining Voided Credit
When a credit note is generated with a refund_amount and/or credit_amount that does not cover the full invoice amount, the system will:
This ensures that:
Example
Invoice total: €20 (2000 cents)
Request:
The system will create:
✅ Credit Note 1: €10 refunded + €5 credited (usable)
🚫 Credit Note 2: €5 voided (not usable)