Skip to main content

API Overview

The X-Link P2P API is a RESTful API that enables secure peer-to-peer payment processing. This overview provides essential information about working with our API.

Base URLs

EnvironmentBase URL
Productionhttps://api.x-link.asia/api/v1/p2p
Staginghttps://api.stage.x-link.asia/api/v1/p2p

API Endpoints

Core Endpoints

MethodEndpointDescription
POST/p2p/sessionsInitialize a payment session
GET/p2p/sessions/{session_id}Get session details
POST/p2p/operationsCreate an operation from session
GET/p2p/operations/{shop_id}/{operation_number}Get operation details
GET/p2p/payment-method-typesList available payment methods

Request Format

Headers

All requests must include these headers:

x-api-key: your-api-key-here
Content-Type: application/json

Request Body

Request bodies should be JSON formatted:

{
"shop_id": 1,
"payment_method_type_id": "550e8400-e29b-41d4-a716-446655440000",
"operation_type": "PAYIN",
"operation_number": "ORDER-12345",
"payer_id": "customer-123",
"amount": "100.00",
"currency": "USD"
}

Response Format

Successful Response

{
"session_id": "550e8400-e29b-41d4-a716-446655440001",
"expired_at": "2024-12-25T10:30:00Z",
"payer_requisites": {
"card_number": "****1234"
},
"payment_method_requisites": {
"card_number": "4242424242424242",
"card_holder": "JOHN DOE",
"expiry_date": "12/25"
}
}

Note: Swagger UI may show additionalProp1/2/3 for objects that allow arbitrary keys (additionalProperties). These are placeholders, not real API fields.

Error Response

{
"detail": "Session not found"
}

Data Types

Operation Types

ValueDescription
PAYINIncoming payment (receiving money)
PAYOUTOutgoing payment (sending money)

Operation Status

StatusDescription
PENDINGOperation created, awaiting processing
PROCESSINGOperation is being processed
SUCCESSOperation completed successfully
FAILEDOperation failed
CANCELLEDOperation was cancelled
REFUNDEDOperation was refunded
DECLINEDOperation was declined

Session Status

StatusDescription
activeSession created and awaiting action/callback
usedSession successfully completed
expiredSession expired or finished unsuccessfully

Currencies

The API supports standard ISO 4217 currency codes:

  • USD - US Dollar
  • EUR - Euro
  • GBP - British Pound
  • RUB - Russian Ruble
  • And more...

Pagination

List endpoints support pagination:

GET /p2p/payment-method-types?shop_id=1&operation_type=PAYIN&page=1&size=20

Response includes pagination metadata:

{
"data": [...],
"page": 1,
"size": 20,
"total": 100,
"pages": 5
}

Filtering and Sorting

Filtering

Apply filters using query parameters:

GET /p2p/operations?operation_type=PAYIN&status=SUCCESS

Sorting

Sort results using sort_by and sort_type:

GET /operations?sort_by=created_at&sort_type=desc

Rate Limits

Limit TypeValue
Requests per minute1000
Burst limit100/second

Rate limit information is included in response headers:

X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: 1628856000

HTTP Status Codes

CodeDescription
200Success
201Created
204No Content
400Bad Request - Invalid parameters
401Unauthorized - Invalid authentication
403Forbidden - Missing or invalid API key
404Not Found - Resource doesn't exist
422Unprocessable Entity - Validation error
429Too Many Requests - Rate limit exceeded
500Internal Server Error

Idempotency

For safe retries, use unique operation_number values:

{
"operation_number": "ORDER-12345-UNIQUE"
}

The API will return the same response for duplicate requests with the same operation_number.

Versioning

The API version is included in the URL path:

/api/v1/p2p/...

We maintain backward compatibility within major versions. Breaking changes will be introduced in new major versions.