Payments
Payment Links
Create shareable payment links for products or custom amounts.
The Payment Links API allows you to create reusable, shareable links for accepting payments. Links can be tied to a product or have a custom amount.
Link Types
| Type | Description |
|---|---|
product | Links to a specific product. Amount is calculated from product price. |
instant | Custom amount payment. Requires amount field. |
Create a payment link
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
link_type | string | Yes | product or instant |
title | string | Yes | Link title |
currency_code | string | Yes | Currency (XOF, USD, etc.) |
description | string | No | Link description |
amount | number | Instant only | Amount for instant links |
product_id | string | Product only | Product ID for product links |
price_id | string | No | Specific price (if product has multiple) |
allow_coupon_code | boolean | No | Allow discount codes (default: false) |
allow_quantity | boolean | No | Allow quantity changes (default: false) |
require_billing_address | boolean | No | Require billing (default: true) |
expires_at | string | No | Expiration date (ISO 8601) |
success_url | string | No | Success redirect URL |
cancel_url | string | No | Cancel redirect URL |
metadata | object | No | Custom key-value pairs |
import { LomiSDK } from '@lomi./sdk';
const lomi = new LomiSDK({
apiKey: process.env.LOMI_API_KEY!,
environment: 'live',
});
// Product link
const productLink = await lomi.paymentLinks.create({
link_type: 'product',
title: 'Premium Subscription',
currency_code: 'XOF',
product_id: 'prod_abc123...',
allow_coupon_code: true,
success_url: 'https://your-site.com/success',
});
// Instant link (custom amount)
const instantLink = await lomi.paymentLinks.create({
link_type: 'instant',
title: 'Donation',
currency_code: 'XOF',
amount: 5000,
description: 'Support our cause',
success_url: 'https://your-site.com/thank-you',
});
console.log(`Share this link: ${productLink.url}`);from lomi import LomiClient
import os
client = LomiClient(
api_key=os.environ["LOMI_API_KEY"],
environment="test"
)
# Product link
product_link = client.payment_links.create({
"link_type": "product",
"title": "Premium Subscription",
"currency_code": "XOF",
"product_id": "prod_abc123...",
"allow_coupon_code": True,
"success_url": "https://your-site.com/success"
})
# Instant link
instant_link = client.payment_links.create({
"link_type": "instant",
"title": "Donation",
"currency_code": "XOF",
"amount": 5000,
"description": "Support our cause"
})
print(f"Share this link: {product_link['url']}")curl -X POST "https://api.lomi.africa/payment-links" \
-H "X-API-KEY: $LOMI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"link_type": "product",
"title": "Premium Subscription",
"currency_code": "XOF",
"product_id": "prod_abc123...",
"allow_coupon_code": true,
"success_url": "https://your-site.com/success"
}'List payment links
Retrieve all payment links with optional filtering.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
linkType | string | Filter by type: product, instant |
isActive | boolean | Filter by active status |
limit | number | Results per page (default: 20) |
offset | number | Pagination offset (default: 0) |
const links = await lomi.paymentLinks.list({
linkType: 'product',
isActive: true,
limit: 20,
});links = client.payment_links.list(
linkType="product",
isActive=True,
limit=20
)curl -X GET "https://api.lomi.africa/payment-links?linkType=product&isActive=true&limit=20" \
-H "X-API-KEY: $LOMI_API_KEY"Get a payment link
Retrieve details of a specific payment link.
const link = await lomi.paymentLinks.get('pl_abc123...');
console.log(`URL: ${link.url}`);link = client.payment_links.get('pl_abc123...')curl -X GET "https://api.lomi.africa/payment-links/pl_abc123..." \
-H "X-API-KEY: $LOMI_API_KEY"Payment Link Object
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier |
url | string | Shareable payment URL |
link_type | string | product or instant |
title | string | Link title |
description | string | Link description |
amount | number | Amount (instant links) |
currency_code | string | Currency code |
product_id | string | Associated product (product links) |
is_active | boolean | Active status |
expires_at | string | Expiration timestamp |
metadata | object | Custom metadata |
created_at | string | Creation timestamp |
Error Responses
| Status | Description |
|---|---|
400 | Invalid input (e.g., amount on product link) |
401 | Invalid or missing API key |
404 | Link not found or access denied |