Updating Merchant Profile

API Documentation for Updating Merchant Profile

This document provides detailed instructions for developers to update the profile of a specific merchant using the provided API.

Endpoint

  • URL: /api/merchants/{merchantId}/profile
  • Method: PUT
  • Content-Type: application/json

Description

This API endpoint allows you to update the profile details of a specific merchant.

Request URL

Replace {merchantId} with the actual merchant ID.

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

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:

  • merchantName (string): The updated name of the merchant. Example: "Updated Merchant ABC"
  • phone (string): The updated phone number of the merchant in the format 966XXXXXXXXX. Example: "966123456790"
  • activityDescription (string): The updated description of the merchant's activities. Example: "Updated description"
  • city (string): The updated city of the merchant. Example: "Updated City"
  • monthlySalesVolume (number): The updated monthly sales volume. Example: 60000
  • salesScope (string): The updated sales scope, either "domestic" or "global". Example: "global"

Example Request Body:

{
  "merchantName": "Updated Merchant ABC",
  "phone": "966123456790",
  "activityDescription": "Updated description",
  "city": "Updated City",
  "monthlySalesVolume": 60000,
  "salesScope": "global"
}

Example curl Command

curl -X PUT https://api.paylink.sa/api/merchants/{merchantId}/profile \
-H "Content-Type: application/json" \
-H "X-API-KEY: your_api_key" \
-d '{
  "merchantName": "Updated Merchant ABC",
  "phone": "966123456790",
  "activityDescription": "Updated description",
  "city": "Updated City",
  "monthlySalesVolume": 60000,
  "salesScope": "global"
}'

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:

{
  "message": "Merchant profile 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 should be able to successfully update the profile of a specific merchant using the API.