Viewing Invoice Details

API Documentation for Viewing Invoice Details

This document provides detailed instructions for developers to view details of a specific invoice for a specific merchant using the provided API.

Endpoint

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

Description

This API endpoint allows you to retrieve 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

  • GET

Request Headers

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

Example curl Command

curl -X GET 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:

{
  "invoiceId": "unique_invoice_id_1",
  "merchantId": "merchant123",
  "invoiceNumber": "INV-1001",
  "date": "2024-07-10",
  "dueDate": "2024-07-31",
  "items": [
    {
      "description": "Web Development Services",
      "quantity": 1,
      "price": 5000
    },
    {
      "description": "Hosting Services",
      "quantity": 1,
      "price": 200
    }
  ],
  "totalAmount": 5200,
  "currency": "SAR",
  "customerInfo": {
    "customerName": "Customer XYZ",
    "customerPhone": "966123456789"
  },
  "invoicePaymentUrl": "http://yourpaymentgateway.com/invoice/unique_invoice_id",
  "callbackUrl": "https://yourcallbackurl.com/invoice-created",
  "status": "paid"
}

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 view details of a specific invoice for a specific merchant using the API.