Refund Payments
Learn how to integrate the SecurePay API refund functionality with in-store POS systems for secure payment refund processing.
Introduction
The refund process involves several key steps to ensure proper transaction handling:
- The POS system receives a refund request and verifies the original transaction's status through the Transaction Query API
- The system confirms the refund request
- The system initiates the refund by calling the Refund Transaction API with the transaction number or reference ID, which generates a unique refund transaction number
- Pockyt communicates the refund details to the digital wallet network, which processes the request and credits the refunded amount to the customer's account
## PrerequisitesTransaction status: You must have a transaction with the
statusparameter set to"success"
Key Implementation Notes
-
Parameter Flow:
transactionNo: Received during the transaction query step and required for refund initiationrefundTransactionNo: Generated upon successful refund initiation, used for tracking and auditingreference: The unique ID associated with the original transaction, used in both query and refund steps
-
API Endpoints:
- Transaction Query: Verifies the status of the original transaction before processing a refund
- Refund Transaction: Initiates the refund request using
transactionNoorreference
-
Webhook Management:
- IPN URL: Configure an IPN (Instant Payment Notification) URL to receive updates on refund status
- Ensure validation of
transactionNoand refund status in webhook notifications
-
Validation:
- All API requests require a valid
verifySignfor authentication - A successful operation is indicated by
ret_code = 000100
- All API requests require a valid
-
Common Error Scenarios:
- Invalid or missing
transactionNoorreference - Incorrect or mismatched refund parameters
- Errors in verifying the
verifySign - Failure to receive webhook notifications due to IPN misconfiguration
- Invalid or missing
API Workflow
API References for Endpoints in this Workflow:
- Step 2: Query Transaction Status
- Step 3: Process Refund
Step-by-Step Refund Workflow Description
Step 1: Refund Request
- Action: The Merchant Backend processes a refund request submitted by the customer for a previous payment
You need a transactionNo and a successful status
Step 2: Query Transaction Status
- Action: The Merchant Backend queries the transaction status to monitor refund progress and handle necessary actions. Refunds are only possible for successful transactions. If the transaction was not successful, a refund cannot be processed
- Endpoint:
POST /v3/tran-query - Key Parameters:
- Request Body: Includes
transactionNoto retrieve transaction details - Response: Returns transaction details, including status, amount, currency, and refund progress
- Request Body: Includes
Step 3: Process Refund
- Action: The Merchant Backend allows the customer to request a refund and initiates the refund process
- Endpoint:
POST app-data-search/v3/refund - Key Parameters:
- Request Body: Includes
transactionNoof the original payment,refundAmount,currency, and optional parameters like the reason for the refund - Response: Returns a
refundTransactionNoand success status confirming that the refund has been processed
- Request Body: Includes
Step 4: Handle Webhook Notification
- Action: After the refund is initiated, Pockyt sends a webhook to the merchant's configured
ipnUrl, containing the refund status, transaction number, and other relevant details - Purpose: To asynchronously confirm the outcome of the refund, enabling the merchant to update internal systems, notify the customer, or trigger any post-refund automation without polling the API
- See Example Webhook Notification Body Here
Step 5: Generate Receipt
- Action: After a successful refund request, the Merchant Backend sends a receipt or notification to the customer
- Process:
- Uses data from the API response to generate a receipt
- Sends the receipt via email or another preferred method
- Response: Confirms that the customer has been notified of the refund
Updated 2 days ago
