Skip to main content

Generate Transaction QR Code API

Overview

Generate a QR code for a transaction that can be scanned by another user to process the payment. This API creates a unique QR code with transaction details including amount, expiry time, and transaction code.

API Details

Endpoint

POST https://api.gafapay.com:8443/gafapay/v3/user/transaction_qr/generate

Headers

companyid: 59388167894b4d10a04fe5da3b8a2104
requestid: be08f79e-7eac-40e1-acbe-00f6ae7b8f7b
Content-Type: application/json
authorization: Token eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJjY2VmZTdhOTI2Zjg0NDNiOTBjYTNlNGU4Y2QwMjUzMCIsInJvbGVzIjpbIlJPTEVfQ1VTVE9NRVIiXSwiZXhwIjoxNzU4ODgzNTIzfQ.zVZYRtD2ZoIW6DUN842q8HpF8ycOoFgG0M90yVFMKlE

Request Body

{
"generator_id": "fb8f09210e0f46b7b4262d77f5b6c273",
"amount": 20,
"txn_code": "CIC",
"expiry_second": 60
}

Request Parameters

  • generator_id (string, required): User ID of the person generating the QR code
    • Example: "fb8f09210e0f46b7b4262d77f5b6c273"
  • amount (number, required): Transaction amount for the QR code
    • Example: 20
  • txn_code (string, required): Transaction code identifier
    • Example: "CIC"
  • expiry_second (number, required): QR code expiry time in seconds
    • Example: 60

Response

{
"success": 1,
"error": [],
"data": {
"amount": 20.0,
"qr_code_id": "d0065c18d7494231ac9b7bd91ab0e5d7",
"generator_id": "fb8f09210e0f46b7b4262d77f5b6c273",
"txn_code": "CIC",
"expiry_at": 1758498691,
"qr_code_string": "R0FGQVFSMTc1ODQ5ODYzMWZiOGYwOTIxMGUwZjQ2YjdiNDI2MmQ3N2Y1YjZjMjczMjAuMA=="
}
}

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
    • amount (number): Transaction amount
    • qr_code_id (string): Unique identifier for the generated QR code
    • generator_id (string): User ID who generated the QR code
    • txn_code (string): Transaction code
    • expiry_at (number): Unix timestamp when the QR code expires
    • qr_code_string (string): Base64 encoded QR code string for scanning

Example Usage

curl --location 'https://api.gafapay.com:8443/gafapay/v3/user/transaction_qr/generate' \
--header 'authorization: Token eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJjY2VmZTdhOTI2Zjg0NDNiOTBjYTNlNGU4Y2QwMjUzMCIsInJvbGVzIjpbIlJPTEVfQ1VTVE9NRVIiXSwiZXhwIjoxNzU4ODgzNTIzfQ.zVZYRtD2ZoIW6DUN842q8HpF8ycOoFgG0M90yVFMKlE' \
--header 'companyid: 59388167894b4d10a04fe5da3b8a2104' \
--header 'requestid: be08f79e-7eac-40e1-acbe-00f6ae7b8f7b' \
--header 'Content-Type: application/json' \
--header 'Cookie: JSESSIONID=46E2E80001D55764685966F3C407654F' \
--data '{
"generator_id": "fb8f09210e0f46b7b4262d77f5b6c273",
"amount": 20,
"txn_code": "CIC",
"expiry_second": 60
}'

Notes

  • The QR code is generated with a unique identifier that can be used for tracking
  • The qr_code_string is a Base64 encoded string that contains the QR code data
  • The generator_id must be a valid user ID in the system
  • The txn_code should be a valid transaction code type
  • The generated QR code can be scanned using the scan transaction QR code API