Pay usage invoices
curl --request POST \
--url https://partners.chargeexpressltd.com/api/public/v1/invoices/usage/pay \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"invoice_ids": [
"<string>"
],
"amount": 123
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({invoice_ids: ['<string>'], amount: 123})
};
fetch('https://partners.chargeexpressltd.com/api/public/v1/invoices/usage/pay', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://partners.chargeexpressltd.com/api/public/v1/invoices/usage/pay"
payload = {
"invoice_ids": ["<string>"],
"amount": 123
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"object": "funding",
"id": "<string>",
"status": "pending",
"amount": "125.50",
"currency": "GHS",
"unit_price": "125.50",
"kwh": "12.5000",
"credited_kwh": "12.5000",
"debt_repaid": "125.50",
"invoice_number": "<string>",
"checkout_url": "<string>",
"credited_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"sandbox": true
}{
"error": {
"type": "authentication_error",
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}Invoices
Pay usage invoices
Creates a funding for the unpaid invoices; a person completes it at checkout_url.
Requires the wallet:write scope.
Requires an Idempotency-Key header.
POST
/
invoices
/
usage
/
pay
Pay usage invoices
curl --request POST \
--url https://partners.chargeexpressltd.com/api/public/v1/invoices/usage/pay \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"invoice_ids": [
"<string>"
],
"amount": 123
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({invoice_ids: ['<string>'], amount: 123})
};
fetch('https://partners.chargeexpressltd.com/api/public/v1/invoices/usage/pay', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://partners.chargeexpressltd.com/api/public/v1/invoices/usage/pay"
payload = {
"invoice_ids": ["<string>"],
"amount": 123
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"object": "funding",
"id": "<string>",
"status": "pending",
"amount": "125.50",
"currency": "GHS",
"unit_price": "125.50",
"kwh": "12.5000",
"credited_kwh": "12.5000",
"debt_repaid": "125.50",
"invoice_number": "<string>",
"checkout_url": "<string>",
"credited_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"sandbox": true
}{
"error": {
"type": "authentication_error",
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}Authorizations
Your fleet API key, e.g. Authorization: Bearer cxk_live_…. Create keys in the fleet portal under Developers.
Headers
Maximum string length:
255Body
application/json
Response
Success
Available options:
funding Available options:
pending, success, failed, expired GHS
Example:
"125.50"
Available options:
GHS GHS per kWh
Example:
"125.50"
kWh this amount buys
Example:
"12.5000"
kWh credited once paid
Example:
"12.5000"
GHS of credit repaid first
Example:
"125.50"
ExpressPay page where a person completes payment. Null in the sandbox.
Present on sandbox top-ups
Available options:
true 
