Operation Types and the Sequence of API Calls
Agent API Overview
The Agent API allows merchants to facilitate peer-to-peer (P2P) payments or make payouts to their clients by using an agent as an intermediary. The agent receives funds from the client on behalf of the merchant or makes payouts to the client from the merchant.
Key Concepts
- Merchant: The business entity that integrates with the Agent API to receive payments or make payouts to their end clients through the agent.
- Agent: The intermediary that handles the transaction, receiving funds from the merchant's client or making payouts to the merchant's clients on behalf of the merchant.
- Client: The end customer making the payment or receiving the payout on behalf of the merchant.
Overview
The operationType parameter in our API is crucial for defining the type of transaction being processed. It distinguishes between two main types of financial operations: payin and payout.
Operation Types
The operationType parameter allows you to specify two primary types of operations:
- Payin: This is when the payer transfers funds to the Agent's account on behalf of the merchant — typically when a customer pays for a service or product.
- Payout: This refers to the disbursement of funds by the Agent to the merchant's client, as instructed by the merchant.
API Sequence Calls
The sequence below is the same for both operation types; the steps where payins and payouts differ are marked inside it.
Request the method types available for your shop and pick one. The list depends on the operation type — payin or payout.
Pass the selected paymentMethodTypeId. The response returns the sessionId, the list of payerRequisites fields to collect and expiredAt — the session is valid for 15 minutes. If the session expires unused, the operation is automatically canceled and a callback with the canceled status is sent.
For every object of the payerRequisites array returned by the session, pass its name and type and add a value field with the collected information.
For a field with type: "file" (for example, a transfer receipt), upload the file with POST /api/v1/upload and pass the returned identifier as the value.
Pass the sessionId and the filled payerRequisites. The operation gets the created status; the response contains paymentMethodRequisites — the agent's payment details.
The requisites are returned by both Create operation and Retrieve operation details.
captured — the agent confirmed the transfer; canceled — the operation was declined or expired. See Callback. To check the status on demand, use GET /api/v1/agents/operations/{shopId}/{operationNumber}.