Pending Payment Flow
Overview
This workflow covers the pending payment processes in the GafaPay system. There are two main components that handle different aspects of pending payments:
1. Receive Payment Request
This component displays and tracks incoming payment requests that users receive from other parties. Users can view and take actions on payment requests that are sent to them.
2. Send Payment Request
This component displays and tracks outgoing payment requests that users send to other parties. Users can view and take actions on payment requests they've initiated.
Both components work together to provide a comprehensive pending payment management system, allowing users to display, track, and take actions on both incoming and outgoing payment requests efficiently.
1. Receive Payment Request
Workflow Steps
-
Fetch Payment Request Users
- Call the Get All Payment Request Users API with specific filters
- Filter by user ID, payment status = 1 (pending), and currency ID
- Extract payment request IDs from the response
-
Get Payment Request Details
- Use the collected payment request IDs to fetch detailed information
- Call the Get All Payment Requests API with query filter
- Display comprehensive payment request information to the user
-
User Actions
- User can review payment request details
- User can take appropriate actions based on the request
Action 1: Decline Request
- Ask user for decline reason
- Call Update Payment Request User API with cancel status
- Update payment status to cancelled
Action 2: Pay Now
- Complete the common transaction flow
- After successful transaction, call Update Payment Request User API with status complete
API References
Get All Payment Request Users
- API: Get All Payment Request Users
- Endpoint:
GET /gafapay/v3/user/payment_request_users - Purpose: Retrieve payment request users with pending status
Required Parameters:
user_id: ID of the logged-in userpayment_status: Set to 1 (pending)currency_id: Currency identifierskip: Pagination offsetlimit: Number of records to return
Example Request:
GET /gafapay/v3/user/payment_request_users?user_id=fb8f09210e0f46b7b4262d77f5b6c273&payment_status=1&skip=0&limit=10¤cy_id=1f1519903ed240578f071aa45cb479f2
Get All Payment Requests
- API: Get All Payment Requests
- Endpoint:
GET /gafapay/v3/user/payment_request - Purpose: Retrieve detailed payment request information using query filters
Query Filter Structure:
[
{
"field_name": "_id",
"operation_type": 1,
"filter_data": ["payment_request_id_1", "payment_request_id_2"]
}
]
Example Request:
GET /gafapay/v3/user/payment_request?query_filter=%5B%7B%22field_name%22:%22_id%22,%22operation_type%22:1,%22filter_data%22:%5B%22bc47de8f53294a44842a421ad90affbe%22%5D%7D%5D
Update Payment Request User
- API: Update Payment Request User
- Endpoint:
PUT /gafapay/v3/user/payment_request_user - Purpose: Update payment request user status (cancel or complete)
Key Use Cases:
- Decline Action: Update status to cancelled with decline reason
- Pay Now Action: Update status to complete after successful transaction
Payment Status Constants:
- Pending: 1 (initial status when request is received)
- Complete: 2 (after successful payment)
- Cancelled: 3 (when request is declined)
For detailed status constants, see Payment Request Constants
Flow Logic
-
Initial Data Retrieval
- Start with the logged-in user's ID
- Set payment status filter to 1 (pending)
- Specify the currency ID for filtering
- Call Get All Payment Request Users API
-
Data Processing
- Extract all
payment_request_idvalues from the response - Store these IDs for the next API call
- Handle pagination if multiple pages exist
- Extract all
-
Detailed Information Retrieval
- Construct query filter with collected payment request IDs
- Use operation type 1 (IN operation) for the
_idfield - Call Get All Payment Requests API with the constructed filter
-
Data Display
- Combine information from both API responses
- Display comprehensive payment request details
- Show user information, amounts, notes, and other relevant data
-
User Interaction
- Present actionable options based on payment request status
- Allow users to review and respond to requests
- Provide clear information about each pending payment request
2. Send Payment Request
Workflow Steps
-
Fetch Payment Requests
- Call the Get All Payment Requests API with user ID and currency ID filters
- Extract payment request IDs from the response
-
Get Payment Request Users Details
- Use the collected payment request IDs to fetch payment request users
- Call the Get All Payment Request Users API with query filter and payment status = 1 (pending)
- Display comprehensive payment request user information
-
User Actions
- User can review sent payment request details
- User can track payment status and user responses
- User can take appropriate actions based on responses
Action 1: Remind User
- Call Remind Payment Request User API to send reminder
- Send notification to the recipient about pending payment
Action 2: Cancel Request
- Ask user for cancel reason
- Call Update Payment Request User API with cancel status
- Update payment status to cancelled
API References
Get All Payment Requests
- API: Get All Payment Requests
- Endpoint:
GET /gafapay/v3/user/payment_request - Purpose: Retrieve payment requests sent by the logged-in user
Required Parameters:
user_id: ID of the logged-in usercurrency_id: Currency identifierskip: Pagination offsetlimit: Number of records to return
Example Request:
GET /gafapay/v3/user/payment_request?user_id=12e10ed1837b4e5b9fad542cf59a555d¤cy_id=1f1519903ed240578f071aa45cb479f2&skip=0&limit=10
Get All Payment Request Users (with Query Filter)
- API: Get All Payment Request Users
- Endpoint:
GET /gafapay/v3/user/payment_request_users - Purpose: Retrieve payment request users for specific payment requests with pending status
Query Filter Structure:
[
{
"field_name": "payment_request_id",
"operation_type": 1,
"filter_data": ["payment_request_id_1", "payment_request_id_2"]
}
]
Example Request:
GET /gafapay/v3/user/payment_request_users?query_filter=%5B%7B%22field_name%22:%22payment_request_id%22,%22operation_type%22:1,%22filter_data%22:%5B%22bc47de8f53294a44842a421ad90affbe%22%5D%7D%5D
Remind Payment Request User
- API: Remind Payment Request User
- Endpoint:
POST /gafapay/v3/user/remind_payment_request_user - Purpose: Send reminder notification to payment request recipient
Required Parameters:
user_id: ID of the recipient useruser_type: Type of the recipient userpayment_request_id: ID of the payment request
Example Request:
POST /gafapay/v3/user/remind_payment_request_user
Content-Type: application/json
{
"user_id": "fb8f09210e0f46b7b4262d77f5b6c273",
"user_type": 2,
"payment_request_id": "bc47de8f53294a44842a421ad90affbe"
}
Flow Logic
-
Initial Data Retrieval
- Start with the logged-in user's ID
- Specify the currency ID for filtering
- Call Get All Payment Requests API to fetch sent requests
-
Data Processing
- Extract all payment request IDs from the response
- Store these IDs for the next API call
- Handle pagination if multiple pages exist
-
Payment Request Users Retrieval
- Construct query filter with collected payment request IDs
- Use operation type 1 (IN operation) for the
payment_request_idfield - Filter by payment status = 1 (pending)
- Call Get All Payment Request Users API with the constructed filter
-
Data Display
- Combine information from both API responses
- Display comprehensive sent payment request details
- Show recipient information, amounts, status, and other relevant data
-
User Interaction
- Present sent payment request information
- Allow users to track payment status and responses
- Provide clear overview of all sent payment requests