Transactions
Create and verify payments.
POST /transactions/initialize
Starts a new payment and returns a checkout URL to redirect your customer to.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| amount | number | Yes | Amount to charge, minimum 1 |
| customer_email | string | Yes | Customer's email address |
| currency | string | No | 3-letter currency code. Defaults to GHS |
Example request
curl -X POST https://starpaysgh.com/api/v1/transactions/initialize \
-H "Authorization: Bearer sk_test_xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"amount": 50, "customer_email": "customer@example.com", "currency": "GHS"}'
$ch = curl_init('https://starpaysgh.com/api/v1/transactions/initialize');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer sk_test_xxxxxxxxxxxx',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'amount' => 50,
'customer_email' => 'customer@example.com',
]),
]);
$response = json_decode(curl_exec($ch), true);
const res = await fetch('https://starpaysgh.com/api/v1/transactions/initialize', {
method: 'POST',
headers: {
Authorization: 'Bearer sk_test_xxxxxxxxxxxx',
'Content-Type': 'application/json',
},
body: JSON.stringify({ amount: 50, customer_email: 'customer@example.com' }),
});
const data = await res.json();
import requests
res = requests.post(
'https://starpaysgh.com/api/v1/transactions/initialize',
headers={'Authorization': 'Bearer sk_test_xxxxxxxxxxxx'},
json={'amount': 50, 'customer_email': 'customer@example.com'},
)
data = res.json()
Example response
{
"status": true,
"data": {
"reference": "TXN-XXXXXXXXXXXXXX",
"checkout_url": "https://starpaysgh.com/checkout/TXN-XXXXXXXXXXXXXX",
"amount": "50.00",
"currency": "GHS"
}
}
GET /transactions/verify/{reference}
Retrieve the current status of a transaction.
Example request
curl https://starpaysgh.com/api/v1/transactions/verify/TXN-XXXXXXXXXXXXXX \
-H "Authorization: Bearer sk_test_xxxxxxxxxxxx"
Example response
{
"status": true,
"data": {
"reference": "TXN-XXXXXXXXXXXXXX",
"status": "success",
"amount": "50.00",
"currency": "GHS",
"customer_email": "customer@example.com",
"paid_at": "2026-07-25T01:19:56+00:00"
}
}
status will be one of: pending, success, failed, or abandoned.