Refund Flow
📋 Overview​
Complete workflow for processing refund transactions for wallet-based payments. The system follows a standardized approach to ensure proper refund processing across different transaction types including P2P, P2M, and other wallet transactions.
🔄 Workflow Steps​
Step 1: Load Currency and Wallet Details​
- System loads active currency and relevant wallet IDs
- Calls the Get Currency Details API to retrieve currency information
- Calls the Get Company Main Wallet API to get company wallet details
- Calls the Get Logged-In User Wallet API to get user wallet information
Step 2: Extract Debit Account Information​
- Parse the original P2M transaction details that is being refunded
- Extract
debit_account_type_idfrom the original transaction - This ID will become the credit user for the new MR (Merchant Refund) transaction
Step 3: Get Credit User Details​
- Use the
debit_account_type_idfrom step 2 as theuser_id - Call the Get User Details API to fetch user information
- Extract user details including username, user type, and other required information
Step 4: Check Product is Allowed and Get Charges Details​
- Follow the same charges calculation flow as regular transactions
- Call the Get User Profile API to get user profile
- Call the Get Profile Product API and pass
product_code: "MR"to check if refund product is allowed - If no record found in profile product API → Product is not allowed, show toast message and stop the process
- If record exists → Continue with charges calculation
- Call the Calculate Charges API and pass
product_code: "MR"to get final charges
Step 5: Get Admin User Details​
- Call the Get All Users API with params
user_type = 1(Admin) - Extract admin user details including username, user type, and other required information
Step 6: Execute Wallet Refund Money API​
- Prepare the request body with all collected information from previous steps
- Include original transaction ID
- Call the Wallet Refund Money API to complete the refund
- If refund is successful, show success message
- If refund fails, show error message and handle accordingly
📡 API References​
Load Currency and Wallet Details​
- APIs: Get Currency Details, Get Company Main Wallet, Get Logged-In User Wallet
- Purpose: Retrieve all necessary currency and wallet information for the refund transaction
Get Credit User Details​
- API: Get User Details API
- Purpose: Retrieve complete user information for the person receiving the refund
Check Product is Allowed and Get Charges Details​
- APIs: Get User Profile, Get Profile Product, Calculate Charges
- Purpose: Check if refund product (MR) is allowed and determine applicable charges and fees for the refund transaction
Get Admin User Details​
- API: Get All Users API with user type filter
- Purpose: Retrieve company admin user information for the refund transaction
Execute Refund​
- API: Wallet Refund Money API
- Purpose: Process the actual refund transaction using all gathered information
Note: For complete API details, request/response formats, and error codes, please refer to the individual API documentation pages linked above.
🔄 Flow Logic​
- Load currency and wallet details → Call multiple APIs to get required IDs
- Extract debit account information → Parse original P2M transaction for credit user ID
- Get credit user details → Call Get User Details API to retrieve user information
- Check product is allowed and get charges → Validate MR product and calculate charges if applicable
- Get admin user details → Call Get All Users API with user_type = 1 to get admin information
- Prepare refund request → Include original transaction ID and all collected information
- Call Wallet Refund Money API → Execute the refund transaction
- If refund succeeds → Show success message
- If any step fails → Show error message and stop the process