WalletSessionId
WalletSessionId
Overview
The WalletSessionId parameter represents a session that allows grouping movements in a wallet. It also allows giving permission to another system to operate debits and credits while the session is open.
Purpose
The WalletSessionId serves several important functions:
- Session Management: Establishes a session context for a series of related operations
- Transaction Grouping: Allows related transactions to be grouped together
- Authorization: Grants temporary permission for GPAS to perform operations on a wallet
- Audit Trail: Facilitates tracking and auditing of related transactions
Lifecycle
- Creation: A WalletSessionId is created when GPAS calls the Sessions method
- Usage: The WalletSessionId is used in subsequent API calls (balance, debit, credit, rollback)
- Termination: The session is closed when GPAS calls the Close method
Implementation Requirements
When implementing the OAS API, ensure that:
- The WalletSessionId is validated in every API call that requires it
- Operations are only permitted if the provided WalletSessionId is valid and active
- All transactions performed within a session are properly associated with that session
- If an invalid or expired WalletSessionId is provided, an appropriate error response is returned
Error Handling
If an invalid WalletSessionId is provided, the OAS should return an error response:
- HTTP Status Code: 400
- Error Code: 1004
- Error Type: INVALID_WALLET_SESSION
- Message: “Invalid wallet session”
Example Usage
The WalletSessionId is typically included as a query parameter in API calls:
GET /wallets/my/balance?walletSessionId=3fa85f64-5717-4562-b3fc-2c963f66afa6HEADERx-parent-system-id: BL13GTx-signature: 52D7382EB6D253CECBD0414AE0CF5B673C9D2D0CPOST /movements/debit?walletSessionId=3fa85f64-5717-4562-b3fc-2c963f66afa6HEADERx-parent-system-id: BL13GTx-signature: 963510BBB54BFB7916BF7D5937539A8AB5E3A633Best Practices
- Session Timeout: Implement a reasonable timeout for wallet sessions to prevent security issues
- Validation: Always validate that the WalletSessionId exists and is active before processing requests
- Logging: Log all operations performed within a session for audit purposes
- Cleanup: Properly clean up resources when a session is closed