API Reference
Complete reference for the GlobalPay.bt API.
Base URL
https://api.gopay.bt
Authentication
All API requests require authentication using Bearer tokens. Include your API key in the Authorization header:
Authorization: Bearer YOUR_API_KEY
Learn more about Authentication.
Rate Limiting
API requests are limited to:
- 1000 requests per hour for standard plans
- 5000 requests per hour for enterprise plans
Rate limit headers are included in all responses:
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: 1640000000
Pagination
List endpoints support pagination using limit and offset parameters:
GET /api/invoices?limit=20&offset=40
Response includes pagination metadata:
{
"data": [...],
"pagination": {
"total": 150,
"limit": 20,
"offset": 40,
"hasMore": true
}
}
Error Handling
The API uses standard HTTP response codes:
| Code | Meaning | |------|---------| | 200 | Success | | 201 | Created | | 400 | Bad Request - Invalid parameters | | 401 | Unauthorized - Invalid API key | | 403 | Forbidden - Insufficient permissions | | 404 | Not Found - Resource doesn't exist | | 429 | Too Many Requests - Rate limit exceeded | | 500 | Internal Server Error |
Error responses include details:
{
"error": {
"message": "Invalid customer ID",
"type": "validation_error",
"code": "invalid_customer",
"field": "customerId"
}
}
Core Resources
/api/invoicesList all invoices
/api/invoicesCreate a new invoice
/api/paymentsList all payments
/api/refundsCreate a refund
Endpoints by Resource
Invoices
Create, retrieve, and manage invoices.
Payments
Process and track payments.
Refunds
Process refunds for completed payments.
Webhooks
Configure webhook endpoints to receive real-time notifications.
Currency Handling
All monetary amounts are in the smallest currency unit (cents/paisa):
{
"amount": 10000, // 100.00 BTN
"currency": "BTN"
}
Supported currencies:
- BTN (Bhutanese Ngultrum)
- USD (US Dollar)
- INR (Indian Rupee)
Idempotency
Prevent duplicate requests by including an idempotency key:
curl -X POST https://api.gopay.bt/api/invoices \\
-H "Authorization: Bearer YOUR_API_KEY" \\
-H "Idempotency-Key: unique-key-123" \\
-H "Content-Type: application/json"
Webhooks
Receive real-time notifications for events:
invoice.createdinvoice.paidpayment.completedpayment.failedrefund.processed
SDKs and Libraries
Official SDKs coming soon for Node.js, Python, PHP, and more.
Testing
Use test API keys and test card numbers to verify your integration without processing real payments.
Need Help?
- Check our Help Center
- Email support@gopay.bt
- View code examples