Skip to main content

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​

Step 2: Extract Debit Account Information​

  • Parse the original P2M transaction details that is being refunded
  • Extract debit_account_type_id from 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_id from step 2 as the user_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​

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​

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​

Note: For complete API details, request/response formats, and error codes, please refer to the individual API documentation pages linked above.

🔄 Flow Logic​

  1. Load currency and wallet details → Call multiple APIs to get required IDs
  2. Extract debit account information → Parse original P2M transaction for credit user ID
  3. Get credit user details → Call Get User Details API to retrieve user information
  4. Check product is allowed and get charges → Validate MR product and calculate charges if applicable
  5. Get admin user details → Call Get All Users API with user_type = 1 to get admin information
  6. Prepare refund request → Include original transaction ID and all collected information
  7. Call Wallet Refund Money API → Execute the refund transaction
  8. If refund succeeds → Show success message
  9. If any step fails → Show error message and stop the process