Remove an Invoice Payment
Use our API to remove an invoice payment.
Follow this guide to remove a payment that has been applied to an invoice. You can only remove a payment from a saved or outstanding invoice. You cannot remove a payment that was made with a payment card. See Remove an Invoice Payment in API Reference for field definitions.
Prerequisites
-
See Create a Sandbox Account to sign up and log in to the Qualpay Manager portal.
-
Follow the steps in Get Your API Credentials to save a sandbox ID and API key.
-
See Authentication to format the credentials and generate your API token. (Alternatively, use the credentials as-is to test this endpoint with our 'Try It!' feature.)
-
Use the Create an Invoice guide to draft and save an invoice. Save the
{invoice_id}from the request response. -
Use the Add Payment to an Invoice guide to apply a payment to the created invoice.
- Save the
payment_idvalue from the request response. - Alternatively, you can find the
payment_idvalue for a payment you wish to cancel by sending a Get Invoice Payments by ID request or a Get Invoice Payments request.
- Save the
Implement
Write a DELETE request. For the request endpoint, insert the {invoice_id} and payment_id values so that the endpoint reads /platform/invoice/{invoice_id}/payments/{payment_id}, where the {invoice_id}value replaces{invoice_id}and thepayment_idvalue replaces{payment_id}.
See the following sample code:
curl --request DELETE \
--url https://api-test.qualpay.com/platform/invoice/22085/payments/10431 \
--header 'accept: application/json' \
--header 'authorization: Basic OjllZZZjMjFhMzFjMjMjFhMzFjMzjMjFhMzFjME2YWJjMTIz'Integrate
Send the request to your custom endpoint.
Qualpay will return a response like the code below:
{
"code": 0,
"message": "Success",
"data": {}
}Check the code field in the request response: 0 confirms that you have successfully sent the invoice. If the value is something other than 0, check Platform API Response Codes in Reference.
See Remove an Invoice Payment in API Reference for response field definitions.
Test and Go Live
See our Test and Go Live guide to test your API integration and to start transacting with an active production account.
Updated about 1 month ago