Introduction
This documentation describes the QR API endpoints for generating and managing QR payment codes in TotalCoin.
Authentication
API access control is implemented using OAuth 2.0 with Bearer Tokens.
Endpoint
POST
api/auth/login
Request
{ "company": "", "username": "", "password": "" }
Field | Type | Description | Required |
---|---|---|---|
company | String | Company Name | Yes |
username | String | Username | Yes |
password | String | Password | Yes |
Response (HTTP 200)
{ "token": "", "expires_in": 3600 }
Field | Type | Description |
---|---|---|
token | String | Authentication token |
expires_in | Number | Token expiration time in seconds |
Common Errors
Code | Description |
---|---|
401 | Invalid or incorrect credentials |
403 | Insufficient permissions to access the API |
QR Endpoints
Generate QR Code
POST
api/qr/generate
Request
{ "amount": 100.00, "currency": "USD", "description": "Payment description", "expires_in": 3600, "customer_email": "customer@example.com", "customer_name": "Customer Name" }
Field | Type | Description | Required |
---|---|---|---|
amount | Number | Payment amount | Yes |
currency | String | Payment currency (USD, EUR, etc.) | Yes |
description | String | Payment description | Yes |
expires_in | Number | Expiration time in seconds | No |
customer_email | String | Customer email address | No |
customer_name | String | Customer name | No |
Response (HTTP 200)
{ "qr_id": "qr_123456789", "qr_code": "data:image/png;base64,...", "qr_url": "https://totalcoin.com/qr/qr_123456789", "expires_at": "2024-03-13T11:00:00Z" }
Field | Type | Description |
---|---|---|
qr_id | String | Unique QR code ID |
qr_code | String | QR code image in base64 format |
qr_url | String | URL to access the QR code |
expires_at | String | QR code expiration date and time |
Check QR Status
GET
api/qr/{qr_id}/status
Response (HTTP 200)
{ "status": "pending", "amount": 100.00, "currency": "USD", "created_at": "2024-03-13T10:00:00Z", "expires_at": "2024-03-13T11:00:00Z", "paid_at": null }
Field | Type | Description |
---|---|---|
status | String | QR status (pending, paid, expired) |
amount | Number | Payment amount |
currency | String | Payment currency |
created_at | String | Creation date and time |
expires_at | String | Expiration date and time |
paid_at | String | Payment date and time (if applicable) |
Important Notes
• All requests must include the authentication token in the Authorization header: Bearer {token}
• Amounts must be decimal numbers with two decimal places
• Default expiration time is 1 hour (3600 seconds)
• Expired QR codes cannot be used for payments
• It is recommended to implement a notification system to receive updates about payment status