API reference · Direct recharge

Request a direct recharge product

POST/v1/wallets/{walletId}/direct-recharges

Pay from this wallet for Anis staff to deliver the payout. Keep the same operation id if the answer is lost. Billing products (billing) are not available yet.

Permissiondirect_recharges:create
AuthenticationSigned purchase
Anis’s answerSigned
Staff-set limits it counts towardAll requests, Purchases (orders limit)
.NET SDKanis.DirectRecharges.CreateAsync(walletId, operationId, request)
  • Every processing 202 contains exactly operationId, operationType and status: "processing"; operationType is directRecharge. 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

NameInTypeNotes
walletIdrequiredpathUUIDA 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: CreateDirectRechargeRequest, as JSON.

FieldTypeNotes
productIdrequiredUUIDThe selected direct recharge product id.
payoutAmountrequiredstringThe desired payout amount string from the quote.
expectedTotalrequiredanyThe total you confirmed from the package or quote, as LYD Money. The balance check is exact up to 999,999.999 LYD.
recipientrequiredlist of DirectRechargeRecipientInputThe keyed recipient values validated against this direct recharge product.
notestringYour optional note for this direct recharge.
externalReferencestringYour reference, included when supplied.

Responses

StatusMeaningBody
200Success.DirectRecharge
202Accepted — no outcome yet.DirectRechargeAccepted
400Refused: the signed request is badly built.Problem
401Refused: not authenticated.Problem
403Refused: not allowed.Problem
404Refused: not found, or not yours.Problem
409Refused: conflicts with the current state.Problem
422Refused: the request breaks a rule.Problem
429Refused: a limit was reached.Problem
503No 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.

ErrorCodeStatus
Invalid credentialsinvalid_credentials401
Malformed signed requestmalformed_signed_request400
Insufficient scopeinsufficient_scope403
Source address not allowedsource_ip_not_allowed403
Rate limitedrate_limited429
Validation failedvalidation_failed422
Service unavailabledependency_unavailable503
Request timeoutrequest_timeout504
Internal errorinternal_error500
Account not authorisedbinding_not_authorized403
Account inactiveaccount_inactive403
Wallet not grantedwallet_not_granted404
Not foundresource_not_found404
Currency not supportedcurrency_not_supported422
Wallet disabledwallet_disabled409
Wallet expiredwallet_expired409
Business subscription requiredbusiness_subscription_required409
Replay detectedreplay_detected409
Operation id already usedidempotency_conflict409
Price changedprice_changed409
Insufficient balanceinsufficient_balance409
Spending cap reachedspending_limit_exceeded429
Direct recharge product unavailabledirect_recharge_product_unavailable409
Amount outside limitsamount_out_of_range422
Purchase not allowedpurchase_not_allowed403

Types

CreateDirectRechargeRequest

FieldTypeNotes
productIdrequiredUUIDThe selected direct recharge product id.
payoutAmountrequiredstringThe desired payout amount string from the quote.
expectedTotalrequiredanyThe total you confirmed from the package or quote, as LYD Money. The balance check is exact up to 999,999.999 LYD.
recipientrequiredlist of DirectRechargeRecipientInputThe keyed recipient values validated against this direct recharge product.
notestringYour optional note for this direct recharge.
externalReferencestringYour reference, included when supplied.

DirectRechargeRecipientInput

FieldTypeNotes
keyrequiredstringThe exact field key supplied by the direct recharge product definition.
valuerequiredstringThe submitted field value; a location choice uses its id.

DirectRecharge

FieldTypeNotes
operationIdalways presentUUIDThe same UUID sent as Idempotency-Key for this purchase.
statusalways presentDirectRechargeStatusThe merged customer-facing status; partial refunds add amounts rather than a new status.
numberalways presentintegerThe recorded direct recharge number.
walletIdalways presentstringThe wallet used for this purchase.
productalways presentDirectRechargeProductReferenceThe purchased direct recharge product's id and title.
payoutalways presentDirectRechargePayoutThe payout string and named currency; not the LYD Money shape.
exchangeRatealways presentstringThe quoted exchange rate as a decimal string.
pricealways presentMoneyThe LYD price including applicable location and holder adjustments.
commissionalways presentMoneyThe LYD commission included in total.
totalalways presentMoneyThe total wallet cost, as LYD Money. The balance check is exact up to 999,999.999 LYD.
recipientalways presentlist of DirectRechargeRecipientValueThe saved recipient values and display labels.
notestringYour optional note for this direct recharge.
externalReferencestringYour reference, included when supplied.
requestedAtalways presentstring (date-time)When the direct recharge was requested, in UTC.
completedAtstring (date-time)The completion time when supplied, in UTC.
proofUrlstringThe recorded delivery proof URL when supplied; no access or expiry guarantee is stated.
reasonstringThe reason for suspension or either rejected state.
partialRefundDirectRechargePartialRefundSettled partial-refund and remaining amounts; occurs only if partial refunds are enabled for the product.

DirectRechargeStatus

DirectRechargeProductReference

FieldTypeNotes
idalways presentUUIDThe selected direct recharge product id.
titlealways presentstringThe direct recharge product's display text.

DirectRechargePayout

FieldTypeNotes
amountalways presentstringThe payout amount as a decimal string.
currencyalways presentDirectRechargeCurrencyThe payout currency display name object.

DirectRechargeCurrency

FieldTypeNotes
namealways presentstringThe display name supplied for this item.

Money

FieldTypeNotes
amountalways presentstringA 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 presentstringAn uppercase three-letter currency code, such as LYD. Read a wallet’s currency from balance.currency.
asOfstring (date-time)When this price or balance was read.

DirectRechargeRecipientValue

FieldTypeNotes
keyalways presentstringThe exact field key supplied by the direct recharge product definition.
nameLocalizedTextThe Arabic and English display labels, omitting empty languages.
valuealways presentstringThe submitted field value; a location choice uses its id.
valueNamestringThe display name of a selected value, when supplied.

LocalizedText

FieldTypeNotes
arstringThe Arabic text; omitted when empty.
enstringThe English text; omitted when empty.

DirectRechargePartialRefund

FieldTypeNotes
refundedPayoutalways presentstringThe refunded or remaining payout as a string in the product currency.
refundedTotalalways presentMoneyThe refunded or remaining LYD wallet amount.
remainingPayoutalways presentstringThe refunded or remaining payout as a string in the product currency.
remainingTotalalways presentMoneyThe refunded or remaining LYD wallet amount.

DirectRechargeAccepted

FieldTypeNotes
operationIdalways presentUUIDThe same UUID sent as Idempotency-Key for this purchase.
operationTypealways presentstringAlways directRecharge. Values: directRecharge
statusalways presentstringAlways processing; the outcome is not final. Values: processing