API reference · Meter charges
Charge a meter
POST/v1/wallets/{walletId}/meter-charges
Buy a meter charge with an operation id you save before sending. A 202 means the charge is accepted or its outcome is still being checked.
Permissionmeter_charges:create
AuthenticationSigned purchase
Anis’s answerSigned
Staff-set limits it counts towardAll requests, Purchases (orders limit)
.NET SDKanis.MeterCharges.CreateAsync(walletId, operationId, request)
- Every processing
202 contains exactly operationId, operationType and status: "processing"; operationType is meterCharge. Full operation reads use 200. - A missing operation read never proves absence. Retry the exact saved body with the same operation id and a fresh signature. A duplicate remains
202 during projection lag. Only a duplicate command on this retry, at or after 60 seconds since original admission, followed by an application-scoped read still not found, closes the operation with idempotency_conflict (409). A read miss or timeout alone never proves a conflict. That code does not prove nothing was charged: the first request may already have been accepted, so read the operation before any new attempt. - This purchase counts toward the existing
orders limit and the same daily application spending cap as card orders and other purchases.
Parameters
| Name | In | Type | Notes |
|---|
walletIdrequired | path | UUID | A UUID, lower-case with hyphens. |
Request
Signed with your key, with a one-time nonce, a digest of the body and your operation id as Idempotency-Key.
Headers: Signature-Input, Signature, Content-Digest, Nonce, Idempotency-Key, X-Anis-Date, Accept-Language (optional). The SDKs set all of them for you.
Body: CreateMeterChargeRequest, as JSON.
| Field | Type | Notes |
|---|
packageIdrequired | UUID | The selected package's id from the package list. |
meterNumberrequired | string | The meter number as text; preserve leading zeros. |
expectedTotalrequired | any | The total you confirmed from the package or quote, as LYD Money. |
externalReference | string | Your reference, included when supplied. |
Responses
| Status | Meaning | Body |
|---|
| 200 | Success. | MeterCharge |
| 202 | Accepted — no outcome yet. | MeterChargeAccepted |
| 400 | Refused: the signed request is badly built. | Problem |
| 401 | Refused: not authenticated. | Problem |
| 403 | Refused: not allowed. | Problem |
| 404 | Refused: not found, or not yours. | Problem |
| 409 | Refused: conflicts with the current state. | Problem |
| 422 | Refused: the request breaks a rule. | Problem |
| 429 | Refused: a limit was reached. | Problem |
| 503 | No decision: a dependency was unavailable. | Problem |
Every answer of this call is signed by Anis — success and every refusal. Require the signature and verify it before you act on the answer; an answer without one is a failure, never an answer (how).
Refusals
Every refusal of this call is a signed problem. Branch on its code; each links to what it means and what to do.
Types
CreateMeterChargeRequest
| Field | Type | Notes |
|---|
packageIdrequired | UUID | The selected package's id from the package list. |
meterNumberrequired | string | The meter number as text; preserve leading zeros. |
expectedTotalrequired | any | The total you confirmed from the package or quote, as LYD Money. |
externalReference | string | Your reference, included when supplied. |
MeterCharge
| Field | Type | Notes |
|---|
operationIdalways present | UUID | The same UUID sent as Idempotency-Key for this purchase. |
statusalways present | MeterChargeStatus | processing, succeeded or failed. A failed read still needs refund.status to explain the money outcome. |
walletIdalways present | string | The wallet used for this purchase. |
meterNumberalways present | string | The meter number as text; preserve leading zeros. |
packagealways present | MeterChargePackage | The package recorded for this charge. |
totalalways present | Money | The frozen total wallet cost in every state, as LYD Money. |
personalPricealways present | Money | The frozen retail display price in every state; do not substitute it for the payable total. |
externalReference | string | Your reference, included when supplied. |
createdAtalways present | string (date-time) | When the charge was recorded, in UTC. |
completedAt | string (date-time) | When the charge succeeded; omitted in processing and failed states. |
receipt | MeterReceipt | Present after successful charging; includes the full token list. |
failure | MeterFailure | The charge failure and localized display message; present for a failed charge. |
refund | MeterRefund | For a failed charge, whether money returned, was not taken or is still pending. |
MeterChargePackage
| Field | Type | Notes |
|---|
idalways present | UUID | The meter package identifier. |
namealways present | string | One stored package name, not a bilingual text object. |
gecolPackageNamealways present | string | The electricity supplier's package name. |
Money
| Field | Type | Notes |
|---|
amountalways present | string | A decimal string, never a JSON number. Wallet balances may be negative while allowed debt is used. Prices and totals follow each route's amount rules. |
currencyalways present | string | An uppercase three-letter currency code, such as LYD. Read a wallet’s currency from balance.currency. |
asOf | string (date-time) | When this price or balance was read. |
MeterReceipt
| Field | Type | Notes |
|---|
receiptNumber | string | The receipt number supplied by the electricity supplier. |
creditedAmount | string | The supplier's credited amount string, passed through unchanged; not the wallet total. |
tokensalways present | list of MeterToken | Every supplier token in sequence order, including key changes before credit. |
taxesalways present | list of MeterTax | The supplier receipt's tax lines. |
MeterToken
| Field | Type | Notes |
|---|
sequencealways present | integer | Supplier token order; preserve gaps rather than renumbering. |
labelalways present | string | The supplier's token label. |
codealways present | string | The complete token string, including spaces and leading zeros. |
description | string | The token's display description when supplied. |
MeterTax
| Field | Type | Notes |
|---|
descriptionalways present | string | The electricity company's original Arabic tax description, unchanged. |
amountalways present | string | The original supplier amount string; no Money-scale conversion. |
MeterFailure
| Field | Type | Notes |
|---|
codealways present | string | A charge-read failure value, not an HTTP problem code. Values: meter_number_invalid, meter_not_whitelisted, meter_not_linked, meter_removed, meter_inactive, meter_account_blocked, meter_data_incomplete, meter_debt_exceeds_package, package_unavailable, package_limit_reached, token_not_written, insufficient_balance, gecol_unavailable, charge_failed |
message | LocalizedText | Arabic and English messages matching the charging result. |
LocalizedText
| Field | Type | Notes |
|---|
ar | string | The Arabic text; omitted when empty. |
en | string | The English text; omitted when empty. |
MeterRefund
| Field | Type | Notes |
|---|
statusalways present | MeterRefundStatus | refunded means returned; notCharged means nothing taken; pending means money has not returned yet. |
amount | any | The refund Money value when present; never infer settlement from this amount alone. |
MeterChargeAccepted
| Field | Type | Notes |
|---|
operationIdalways present | UUID | The same UUID sent as Idempotency-Key for this purchase. |
operationTypealways present | string | Always meterCharge. Values: meterCharge |
statusalways present | string | Always processing; the outcome is not final. Values: processing |