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

  1. See Create a Sandbox Account to sign up and log in to the Maast Manager portal.

  2. Follow the steps in Get Your API Credentials to save a sandbox ID and API key.

  3. 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.)

  4. Use the Create an Invoice guide to draft and save an invoice. Save the invoice_id from the request response.

  5. Use the Add Payment to an Invoice guide to apply a payment to the created invoice.


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 the payment_id value replaces {payment_id}.

See the following sample code:

curl --request DELETE \
     --url https://api-test.maast.com/platform/invoice/22085/payments/10431 \
     --header 'accept: application/json' \
     --header 'authorization: Basic OjllZGVjMjFhMzFjMHh5ejc4OWUzMGEzNDE2YWJjMTIz'

Integrate

Send the request to your custom endpoint.

Maast 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.