Skip to main content

Save Payment Link API

Overview

Create a new payment link with the specified details. Payment links can be shared with target users for collecting payments.

API Details

Endpoint

POST https://api.gafapay.com/gafapay/v3/user/payment_link

Headers

authorization: Token eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJlNDk0Njg3N2YxODk0NmIyOTlmZGRmMGYyMTMzZGNiYSIsInJvbGVzIjpbIlJPTEVfQURNSU4iXSwiZXhwIjoxNzU3MDA3NDEyfQ.ph7qKBEzuHxgljV3141L9iOrWmHI4TnyoknBSNoVYYU
companyid: b760d21412dd473999e374053fb95031
requestid: be08f79e-7eac-40e1-acbe-00f6ae7b8f7b
Content-Type: application/json

Request Body

{
"link_number": "PL_123456",
"user_id": "fb8f09210e0f46b7b4262d77f5b6c273",
"user_type": 2,
"business_id": "biz_abc123",
"payment_link": "https://pay.gafapay.com/link/xyz",
"target_user_id": null,
"target_user_type": null,
"target_user_info": null,
"amount": 100.50,
"note": "Payment for services",
"expiry_date": 1756656000,
"status": 1,
"link_name": "Invoice #001",
"link_description": "Payment link for invoice",
"charges_info": null,
"company_id": "b760d21412dd473999e374053fb95031"
}

Request Body Fields

Required Fields
  • company_id (string, required): Company identifier (also set via companyid header)
    • Format: UUID string
    • Example: "b760d21412dd473999e374053fb95031"
Optional Fields
  • link_number (string, optional): Custom link number. Auto-generated if not provided.
  • user_id (string, optional): User ID of the link creator.
  • user_type (integer, optional): Type of user (2=Customer, 3=Merchant, 5=Agent). See Constants.
  • business_id (string, optional): Business ID associated with the link.
  • payment_link (string, optional): Payment link URL or identifier.
  • target_user_id (string, optional): Target user ID for the payment.
  • target_user_type (integer, optional): Target user type.
  • target_user_info (object, optional): Map of target user information.
  • amount (number, optional): Payment amount.
  • note (string, optional): Note or description for the link.
  • expiry_date (long, optional): Expiry timestamp (epoch seconds). Default: 60 seconds from creation if not provided.
  • status (integer, optional): Link status. Default: 1 (Created). See Constants for payment link status values.
  • link_name (string, optional): Display name for the link.
  • link_description (string, optional): Description of the link.
  • charges_info (object, optional): Map of charges/fee information.

Response

{
"success": 1,
"error": [],
"data": {
"payment_link_id": "a1b2c3d4e5f6g7h8i9j0",
"message": "USER_PAYMENT_LINK_SAVED_SUCCESSFULLY"
}
}

Response Fields

  • success (integer): Response status indicator (1 = Success, 0 = Failure)
  • error (array): Array of error messages (empty on success)
  • data (object): Response data object
    • payment_link_id (string): Unique identifier of the created payment link
    • message (string): Success message

Example Usage

curl --location 'https://api.gafapay.com/gafapay/v3/user/payment_link' \
--header 'authorization: Token eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...' \
--header 'companyid: b760d21412dd473999e374053fb95031' \
--header 'requestid: be08f79e-7eac-40e1-acbe-00f6ae7b8f7b' \
--header 'Content-Type: application/json' \
--data '{
"user_id": "fb8f09210e0f46b7b4262d77f5b6c273",
"user_type": 2,
"amount": 100.50,
"link_name": "Invoice #001",
"status": 1
}'

Notes

  • company_id is required and is typically set from the companyid header by the backend.
  • Payment link status values: 1=Created, 2=Expired, 3=Completed, 4=Cancelled. See Constants.
  • If link_number is omitted, a transaction ID is generated automatically.
  • If expiry_date is omitted, it defaults to 60 seconds from creation time.