Create charge for a customer via mobile
Charge a mobile money wallet directly, without an invoice behind it. Send the payer a code first with Send a one-time code, then call this with that code in otp. Until a valid code arrives the endpoint answers 428 Precondition Required.
This endpoint needs your API key
Send it as a bearer token in the Authorization header. A request without one is answered with 401. See Authentication for where to find your key and how to keep it secret.
Request
curl -X POST "https://api.leapa.co/v2/charges/mobile" \
-H "Authorization: Bearer $LEAPA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": 45000,
"currency": "BIF",
"description": "Room 204, two nights",
"customer": {
"email": "jeanne@example.com",
"address": {
"city": "string",
"state": "string",
"type": "personal",
"country": "AD",
"zip": "string",
"line1": "string",
"line2": "string"
},
"first_name": "Jeanne",
"last_name": "Ndayishimiye",
"birth_date": "2026-01-31",
"phone_number": "+25779123456"
},
"source": {
"brand": "ecocash",
"currency": "BIF",
"number": "string",
"country_code": "BI",
"default": false
},
"source_id": "src_0e7b3c95af",
"customer_id": "cus_3d8e51fa20",
"captured": false,
"invoice_reference_id": "string",
"customer_reference_id": "string",
"otp": "string"
}'Response
Created
{
"id": "obj_5f21c8a40b",
"object": "string",
"amount": 45000,
"currency": "BIF",
"description": "Room 204, two nights",
"status": "succeeded",
"source": {
"id": "obj_5f21c8a40b",
"brand": "ecocash",
"funding": "credit",
"last4": "string",
"email": "jeanne@example.com",
"fingerprint": "string",
"token": "string",
"language": "string",
"number": "string",
"cvc_check": "pass",
"exp_month": "string",
"exp_year": "string",
"statement_descriptor": "string",
"country_code": "string"
},
"affiliate": "dwelinn",
"amount_refunded": 45000,
"available_date": 0,
"captured": false,
"created_date": 0,
"disputed": false,
"failure_code": "string",
"failure_message": "string",
"invoice_id": "inv_7c1f9a2b48",
"live": false,
"modified_date": 0,
"refunded": false,
"customer_id": "cus_3d8e51fa20",
"processing_id": "string",
"quittance_number": "string"
}Request body
Required. Send it as JSON.
amountinteger<int64>requiredAmount to charge, in the smallest unit the currency uses. BIF has no minor unit, so 45000 is 45,000 francs.
currencystringrequiredCurrency of the charge. It has to match the currency account your API key was issued for.
Allowed values:BIFUSDKESXAFdescriptionstringrequiredWhat the payment is for. Shown in your Leapa dashboard and on the payer’s statement.
Must be:5 to 100 characterscustomerCustomerRequestMobileA new customer to create and charge in one call. Send this or customer_id, not both.
emailstringCustomer's email address. Constraints: Not null, Valid email format
addressAddressRequestGenericcitystringrequiredCity. Constraints: Not null, Size(min=3, max=90)
Must be:3 to 90 charactersstatestringState. Constraints: Size(min=1, max=90)
Must be:1 to 90 characterstypestringrequiredThe type of address. Constraints: Not null
Allowed values:personalbusinesscountrystringrequired2 letter ISO Country Code. Constraints: Not null, Size(min=2, max=3)
Allowed values:ADANDAEAREAFAFGAGATGand 492 morezipstringZip. Constraints: Size(min=1, max=15)
Must be:1 to 15 charactersline1stringrequiredLine 1. Constraints:Not null, Size(min=1, max=90)
Must be:1 to 90 charactersline2stringrequiredLine 2. Constraints: Size(min=1, max=90)
Must be:1 to 90 characters
first_namestringCustomer's firstname. Constraints: Size(min=3, max=30)
Must be:at most 30 characterslast_namestringCustomer's lastName. Constraints: Size(min=3, max=30)
Must be:at most 30 charactersbirth_datestringCustomer's birthdate. Constraints: format(YYYY-MM-DD)
Must be:matches ^\d{4}-\d{2}-\d{2}$phone_numberstringCustomer's phone number. Constraints: only digit 0-9 and Size(min=1, max=15)
Must be:matches ^\+?(?:[0-9] ?){6,14}[0-9]$
sourceMobileRequestThe mobile money wallet to charge. Send this or source_id, not both.
brandstringrequiredCustomer mobile money brand)
Allowed values:ecocashenotiibb+pesaflashbrbbcbbancobubbciand 78 morecurrencystringrequiredCurrency code
Allowed values:BIFUSDKESXAFnumberstringrequiredCustomer mobile money number)
country_codestringrequiredCustomer mobile money country code)
Allowed values:BIdefaultbooleanrequiredIndicating whether this payment method is the default sources of payment. Constraints: Not null
source_idstringA wallet already saved on the customer. Send this or source.
customer_idstringAn existing customer to charge. Send this or customer.
capturedbooleanrequiredWhether to immediately capture the charge or not.
invoice_reference_idstringYour own id for the bill this charge settles, echoed back on the charge. It does not create or settle a Leapa invoice.
customer_reference_idstringYour own id for the customer, echoed back on the charge so you can match it to your records.
otpstringThe six-digit code the payer received from Send a one-time code. The charge answers 428 until you send a valid one.
Must be:6 to 6 characters
Response
idstringobjectstringamountinteger<int64>currencystringAllowed values:BIFUSDKESXAFdescriptionstringstatusstringAllowed values:succeededpaidpendingfailedsourceSourceObjectidstringSource id
brandstringPayment Method Brand Name: Either Mastercard, Visa or Ecocash(Mobile Money)
Allowed values:ecocashlumicashmastercardvisafundingstringCard funding type. Either credit, debit, prepaid, or unknown
Allowed values:creditdebitprepaidunknownlast4stringLast Four ditgits of the card
emailstringEmail of the card Owner.
fingerprintstringUnique identifier of the card number as returned by the CyberSource TMS API
tokenstringUnique identifier of the card data as returned by the CyberSource TMS API
languagestringPrefered Language of the Customer. Used for Mobile Money.
numberstringThe mobile money number.
cvc_checkstringCard Verification Code check result
Allowed values:passfailunavailableuncheckedexp_monthstringTwo digit number representing the expiration number
exp_yearstringFour digit number representing the expiration date
statement_descriptorstringProvides information about the charge that customers see on their statements. Maximum 22 characters.
country_codestringCountry Code, needed when the Payment Method is Mobile Money.
affiliatestringAllowed values:dwelinnamount_refundedinteger<int64>available_dateinteger<int64>capturedbooleancreated_dateinteger<int64>disputedbooleanfailure_codestringfailure_messagestringinvoice_idstringlivebooleanmodified_dateinteger<int64>refundedbooleancustomer_idstringprocessing_idstringquittance_numberstring
Status codes
201Created400Bad request401Unauthorized402Payment required403Forbidden404Not found428Precondition required500Server error