Skip to main content

API: Request examples

Overview

The documentation uses a sample shop ID 245. API requests are demonstrated for both payin (deposit) and payout (withdrawal) operations, complete with corresponding responses for different scenarios. Each example includes the necessary headers and payloads to ensure successful communication with the API endpoints.

Step 1. Get available payment method types

Request

curl -L -X GET 'https://gateway.fundix.me/api/v1/agents/payment-method-types?shopId=245&operationType=payin' \
-H 'Accept: application/json' \
-H 'Api-Access-Token: be128487-6ba9-4e69-ae55-4355ee8e3333'

Response

{
"data": [
{
"id": "1ef49015-a03b-661a-a03a-b61387989273",
"name": "Test payment method type",
"instrumentType": "cash",
"country": "CA",
"currency": "CAD",
"minAmount": "1",
"maxAmount": "1000"
},
{
"id": "1ef4905e-9997-6cd4-841c-b61387989273",
"name": "Orange bank",
"instrumentType": "bank_transfer",
"country": "CM",
"currency": "RUB",
"minAmount": "1",
"maxAmount": "1000"
}
]
}

Step 2. Initialize a new session

Request

curl -L -X POST 'https://gateway.fundix.me/api/v1/agents/sessions' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Api-Access-Token: be128487-6ba9-4e69-ae55-4355ee8e3333' \
--data-raw '{
"paymentMethodTypeId": "1ef49015-a03b-661a-a03a-b61387989273",
"operationType": "payin",
"shopId": 245,
"operationNumber": "001",
"payerId": "payer123",
"amount": "100.25",
"currency": "CAD"
}'

Response

{
"data": {
"sessionId": "1ef58ca7-ee58-6728-8913-ce9868d5084f",
"expiredAt": "2024-08-12T17:02:00+00:00",
"payerRequisites": [
{
"name": "payin_email",
"title": "Payin email",
"type": "string"
}
]
}
}

Step 3. Create a new P2P operation

Request

curl -L -X POST 'https://gateway.fundix.me/api/v1/agents/operations' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Api-Access-Token: be128487-6ba9-4e69-ae55-4355ee8e3333' \
--data-raw '{
"sessionId": "1ef58ca7-ee58-6728-8913-ce9868d5084f",
"payerRequisites": [
{
"value": "johndoecustomer@example.com",
"name": "payin_email",
"type": "string"
}
]
}'

Response

{
"data": {
"operation": {
"type": "payin",
"id": 33431,
"shopId": 245,
"operationNumber": "001",
"paymentMethodRequisites": [
{
"name": "iban",
"value": "423432432"
}
],
"payerId": "payer123",
"amount": "100.25",
"currency": "CAD",
"settlementAmount": "72.93",
"settlementCurrency": "USD",
"registeredAt": "2024-08-12T16:47:00+00:00",
"updatedAt": "2024-08-12T16:51:22+00:00",
"status": "created",
"isCorrection": false,
"payerDetails": [
{
"name": "payin_email",
"title": "Payin email",
"type": "string",
"value": "johndoecustomer@example.com"
}
]
},
"parent": null
}
}

Step 4. Retrieve P2P operation details

After the agent has confirmed the successful completion of the operation.

Request

curl -L -X GET 'https://gateway.fundix.me/api/v1/agents/operations/245/001' \
-H 'Accept: application/json' \
-H 'Api-Access-Token: be128487-6ba9-4e69-ae55-4355ee8e3333'

Response

{
"data": {
"operation": {
"type": "payin",
"id": 33431,
"shopId": 245,
"operationNumber": "001",
"paymentMethodRequisites": [
{
"name": "iban",
"value": "423432432"
}
],
"payerId": "payer123",
"amount": "100.25",
"currency": "CAD",
"settlementAmount": "72.93",
"settlementCurrency": "USD",
"registeredAt": "2024-08-12T16:47:00+00:00",
"updatedAt": "2024-08-12T16:56:50+00:00",
"status": "captured",
"isCorrection": false,
"payerDetails": [
{
"name": "payin_email",
"title": "Payin email",
"type": "string",
"value": "johndoecustomer@example.com"
}
]
},
"parent": null
}
}