Purchase
The WaafiPay API supports multiple payment actions through a unified endpoint. For Purchase actions, use the serviceName
parameter with different values to initiate a purchase, cancel a purchase, or refund a purchase.
1. Purchase
- serviceName:
API_PURCHASE
- Purpose: Charges the payer's account, completing the payment.
- Request Example: Set
serviceName
toAPI_PURCHASE
and customizepayerInfo
andtransactionInfo
as required.
Request Structure
Request Parameters
Parameter | Data Type | Length | Presence | Description |
---|---|---|---|---|
schemaVersion | String | 5 | Constant | API schema version (e.g., "1.0") |
requestId | String | 36 (UUID) | Required | Unique request identifier (e.g., UUID) |
timestamp | String | 20 | Required | Date and time of the request |
channelName | String | 3-10 | Constant | The channel through which the request was made |
serviceName | String | 15-25 | Constant | The name of the service being called (e.g., API_PURCHASE) |
merchantUid | String | 7-15 | Required | Unique identifier provided by WaafiPay upon merchant account setup |
apiUserId | String | 7-15 | Required | API user identifier for the merchant |
apiKey | String | 20-40 | Required | API key for request authentication |
paymentMethod | String | 5-20 | Required | Payment method being used (e.g., MWALLET_ACCOUNT) |
payerInfo.accountNo | String | 10-20 | Required | Account number of the payer |
transactionInfo.referenceId | String | 1-50 | Required | Your unique internal transaction or order reference (e.g. order number, invoice ID, or bill number). Used for querying and reconciliation. Only letters, numbers, dashes, underscores, and dots are allowed. |
transactionInfo.invoiceId | String | 1-50 | Required | Invoice ID can be the same as the referenceId |
transactionInfo.amount | Number | N/A | Required | Transaction Amount to be charged for the customer (numeric) in two decimal places |
transactionInfo.currency | String | 3 | Required | ISO 4217 currency code for the transaction (e.g. USD, SLSH, DJF) |
transactionInfo.description | String | 0-255 | Optional | Description of the transaction (e.g., random sentence) |
Response Structure
2.Purchase Reversal
- serviceName:
API_CANCELPURCHASE
- Purpose: Reverses the payment for a previously completed purchase.
- Request Example: Set
serviceName
toAPI_CANCELPURCHASE
and include thetransactionId
of the original transaction.
Request Structure
Response Structure
Summary:
- Response: Contains the result of the cancellation, including transaction status (
approved
), description, and the associated transaction ID.