🏠DocumentationAPI Reference
API Documentation

API Reference

Complete API documentation for integrating Pi payments into your application

Introduction

Zyrapayprovides a simple REST API for creating Pi payment checkouts, managing wallets, and handling transactions. All API requests are made to api.zyrapay.net and require authentication using your API key.

Authentication

All API requests require authentication using your API key in the request headers.

Headers Required

apikey - Your project API key
Content-Type - application/json
curl
curl --request POST \ --url https://api.checkout.zyrapay.net \ --header 'Content-Type: application/json' \ --header 'apikey: YOUR_API_KEY' \ --data '{ "items": [{"name": "Product", "amount": 10.00}], "successUrl": "https://yourapp.com/success", "cancelUrl": "https://yourapp.com/cancel", "currency": "USD" }'

Checkout

Create checkout sessions for Pi payments and manage payment processing.

POST/checkout

Create a new checkout session for Pi payments

Request Body

200
{
"items": [{"name":"Premium Plan","description":"Monthly subscription","quantity":1,"image":"https://yourapp.com/image.jpg","amount":29.99}],
"successUrl": "https://yourapp.com/success",
"cancelUrl": "https://yourapp.com/cancel",
"currency": "USD",
"webhookUrl": "https://yourapp.com/webhook",
"expiresInMinutes": 45,
"metadata": {
"orderId": "order_123",
"customerEmail": "customer@example.com"
}
}

Response

200
{
"success": true,
"checkoutUrl": "https://checkout.zyrapay.net/ch_xyz123",
"checkoutId": "checkout_xyz123",
"expiresAt": "2024-01-15T11:15:00Z",
"totalAmount": 29.99,
"currency": "USD"
}
GET/checkout/{checkoutId}

Get details of a specific checkout session

Response

200
{ "success": true, "checkoutId": "ch_xyz123", "status": "completed", "totalAmount": 29.99, "currency": "USD", "items": [...], "createdAt": "2024-01-15T10:30:00Z", "expiresAt": "2024-01-15T11:15:00Z" }

Wallets

Create and manage Pi wallets for your users.

POST/wallet

Create a new Pi wallet

Response

200
{
"status": "success",
"data": {
"wallet_address": "GDQNY3PBO...",
"wallet_id": "123456789",
"created_at": "2024-01-15T10:30:00Z"
}
}

Transactions

View and manage payment transactions.

GET/transactions

List all transactions for your account

Response

200
{
"success": true,
"transactions": [{"id":"txn_123","checkoutId":"checkout_xyz123","amount":29.99,"currency":"USD","status":"completed","createdAt":"2024-01-15T10:30:00Z"}],
"total": 1,
"page": 1,
"limit": 10
}

Error Handling

Zyrapayuses conventional HTTP response codes to indicate success or failure of API requests.

Error Response Format

400
{
"success": false,
"message": "Invalid API key",
"error": "UNAUTHORIZED",
"statusCode": 401
}

Common Error Codes

400 - Bad Request
401 - Unauthorized
404 - Not Found
429 - Rate Limited
500 - Server Error
Chat with AI