Cancelling an Invoice

API Documentation for Cancelling an Invoice

This document provides detailed instructions for developers to delete an invoice for a specific merchant using the provided API.

Endpoint

  • URL: /api/merchants/{merchantId}/invoices/{invoiceId}
  • Method: DELETE
  • Content-Type: application/json

Description

This API endpoint allows you to delete a specific invoice for a particular merchant. The invoice must be in a not-paid status to be canceled. If the invoice is paid, then it will be requested for refunding

Request URL

Replace {merchantId} with the actual merchant ID and.{invoiceId} with the actual invoice ID.

https://api.paylink.sa/api/merchants/{merchantId}/invoices/{invoiceId}

HTTP Method

  • DELETE

Request Headers

  • Content-Type: application/json
  • X-API-KEY: your_api_key

Example curl Command

curl -X DELETE https://api.paylink.sa/api/merchants/{merchantId}/invoices/{invoiceId} \
-H "Content-Type: application/json" \
-H "X-API-KEY: your_api_key"

Replace {merchantId} and {invoiceId} with the actual merchant ID and invoice ID, and your_api_key with your actual API key in the headers.

Success Response

If the request is successful, you will receive a 200 OK status code with the following response body:

{
  "message": "Invoice deleted successfully."
}

Error Response

If there is an error in the request, you will receive a 400 Bad Request status code with an error message:

{
  "message": "Invalid request data"
}

By following these steps and using the provided documentation, you should be able to successfully delete a specific invoice for a specific merchant using the API.