Cancelling a payment thru the API
When a user updates a Contribution with the status "Completed" to have the status "Cancelled" thru the UI (or the API using Contribution.create and an id) a negative payment is created with a status of "Cancelled" like in the screen shot below:
This works fine if you are cancelling a full contribution however there is now way in the UI or the API to cancel one of multiple payments.
For Example:
- a user has a $10 contribution with two payments one for $2 and one for $8
- The user wants to cancel the $2 contribution
If you cancel the contribution it will record a negative payment of $10.
IF you do Payment.cancel
it will record a negative payment of $2 with a status "Refunded"
Using FinancialTrxn.create
you can create a payment of -$2 with a status of "Cancelled" but it will not update the contribution status AND when you update the contribution status to "Cancelled" a new negative payment (of -$10) will be created with a status of cancelled.
PROPOSED SOLUTIONS:
- Update the
Contribution.create
api so that there is a flag to not create new payments. - Allow 'status_id' to be passed to the Payment API and update the contribution and payment statuses based on the status_id if provided