Payments
Payment Requests
Send payment requests to customers with expiration dates.
The Payment Requests API allows you to create timed payment requests for customers. Useful for invoicing and B2B payments.
Create a payment request
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
amount | number | Yes | Amount to request |
currency_code | string | Yes | Currency (XOF, USD, etc.) |
expiry_date | string | Yes | Expiration date (ISO 8601) |
description | string | No | Payment description |
customer_id | string | No | Existing customer ID |
payment_reference | string | No | Invoice/order reference |
metadata | object | No | Custom key-value pairs |
import { LomiSDK } from '@lomi./sdk';
const lomi = new LomiSDK({
apiKey: process.env.LOMI_API_KEY!,
environment: 'live',
});
const request = await lomi.paymentRequests.create({
amount: 50000,
currency_code: 'XOF',
expiry_date: '2024-02-15T23:59:59Z',
description: 'Invoice #INV-2024-001',
customer_id: 'cus_abc123...',
payment_reference: 'INV-2024-001',
metadata: {
invoice_id: 'INV-2024-001',
},
});
console.log(`Payment request created: ${request.id}`);
console.log(`Payment URL: ${request.payment_url}`);from lomi import LomiClient
import os
client = LomiClient(
api_key=os.environ["LOMI_API_KEY"],
environment="test"
)
request = client.payment_requests.create({
"amount": 50000,
"currency_code": "XOF",
"expiry_date": "2024-02-15T23:59:59Z",
"description": "Invoice #INV-2024-001",
"customer_id": "cus_abc123...",
"payment_reference": "INV-2024-001"
})
print(f"Payment request: {request['id']}")curl -X POST "https://api.lomi.africa/payment-requests" \
-H "X-API-KEY: $LOMI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": 50000,
"currency_code": "XOF",
"expiry_date": "2024-02-15T23:59:59Z",
"description": "Invoice #INV-2024-001",
"customer_id": "cus_abc123...",
"payment_reference": "INV-2024-001"
}'List payment requests
Retrieve all payment requests with optional filtering.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
status | string | Filter by status: pending, completed, failed, expired |
customerId | string | Filter by customer ID |
limit | number | Results per page (default: 20) |
offset | number | Pagination offset (default: 0) |
const requests = await lomi.paymentRequests.list({
status: 'pending',
limit: 20,
});requests = client.payment_requests.list(status="pending", limit=20)curl -X GET "https://api.lomi.africa/payment-requests?status=pending&limit=20" \
-H "X-API-KEY: $LOMI_API_KEY"Get a payment request
Retrieve details of a specific payment request.
const request = await lomi.paymentRequests.get('pr_abc123...');
console.log(`Status: ${request.status}`);request = client.payment_requests.get('pr_abc123...')curl -X GET "https://api.lomi.africa/payment-requests/pr_abc123..." \
-H "X-API-KEY: $LOMI_API_KEY"Payment Request Object
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier |
amount | number | Requested amount |
currency_code | string | Currency |
status | string | pending, completed, failed, expired |
description | string | Description |
customer_id | string | Associated customer |
payment_reference | string | Reference number |
payment_url | string | URL for customer to pay |
expiry_date | string | Expiration timestamp |
transaction_id | string | Created transaction (when paid) |
metadata | object | Custom metadata |
created_at | string | Creation timestamp |
Webhooks
| Event | Description |
|---|---|
payment_request.completed | Payment received |
payment_request.expired | Request expired without payment |
Error Responses
| Status | Description |
|---|---|
400 | Invalid input |
401 | Invalid or missing API key |
404 | Request not found |