Updating an Invoice
API Documentation for Updating an Invoice
This document provides detailed instructions for developers to update a specific invoice for a specific merchant using the provided API.
Endpoint
- URL:
/api/merchants/{merchantId}/invoices/{invoiceId}
- Method:
PUT
- Content-Type:
application/json
Description
This API endpoint allows you to update details of a specific invoice for a specific merchant.
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
PUT
Request Headers
Content-Type: application/json
X-API-KEY: your_api_key
Request Body
The request body must be in JSON format and include the following fields:
- items (array of objects): An array of items included in the invoice. Each item object should contain:
- description (string): Description of the item. Example:
"Web Development Services"
- quantity (number): Quantity of the item. Example:
1
- price (number): Price per item. Example:
5000
- description (string): Description of the item. Example:
- totalAmount (number): The total amount for the invoice. Example:
5200
- dueDate (string): The date by which the invoice should be paid, in
YYYY-MM-DD
format. Example:"2024-07-31"
- currency (string): The currency of the invoice. Example:
"SAR"
Example Request Body:
{
"items": [
{
"description": "Web Development Services",
"quantity": 1,
"price": 5000
},
{
"description": "Hosting Services",
"quantity": 1,
"price": 200
}
],
"totalAmount": 5200,
"dueDate": "2024-07-31",
"currency": "SAR"
}
Example curl
Command
curl
Commandcurl -X PUT https://api.paylink.sa/api/merchants/{merchantId}/invoices/{invoiceId} \
-H "Content-Type: application/json" \
-H "X-API-KEY: your_api_key" \
-d '{
"items": [
{
"description": "Web Development Services",
"quantity": 1,
"price": 5000
},
{
"description": "Hosting Services",
"quantity": 1,
"price": 200
}
],
"totalAmount": 5200,
"dueDate": "2024-07-31",
"currency": "SAR"
}'
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 updated 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 can successfully update a specific invoice for a specific merchant using the API.
Updated 7 months ago