Viewing Merchant Dashboard Metrics

API Documentation for Viewing Merchant Dashboard Metrics

This document provides detailed instructions for developers to view dashboard metrics for a specific merchant using the provided API.

Endpoint

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

Description

This API endpoint allows you to retrieve dashboard metrics for a specific merchant.

Request URL

Replace {merchantId} with the actual merchant ID.

https://api.paylink.sa/api/merchants/{merchantId}/dashboard

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}/dashboard \
-H "Content-Type: application/json" \
-H "X-API-KEY: your_api_key"

Replace {merchantId} with the actual merchant 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:

{
  "totalSales": 100000,
  "totalInvoices": 50,
  "totalPaidInvoices": 10,
  "totalDeclinedInvoices": 10,
  "totalPendingInvoices": 30,
  "totalCustomers": 50,
  "balance": 50000,
  "pendingSettlements": 10000
}

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 dashboard metrics for a specific merchant using the API.