Skip to content

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.

POST https://api.leapa.co/v2/charges/mobile

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

application/json

Required. Send it as JSON.

  • amountinteger<int64>required

    Amount to charge, in the smallest unit the currency uses. BIF has no minor unit, so 45000 is 45,000 francs.

  • currencystringrequired

    Currency of the charge. It has to match the currency account your API key was issued for.

    Allowed values:BIFUSDKESXAF
  • descriptionstringrequired

    What the payment is for. Shown in your Leapa dashboard and on the payer’s statement.

    Must be:5 to 100 characters
  • customerCustomerRequestMobile

    A new customer to create and charge in one call. Send this or customer_id, not both.

  • sourceMobileRequest

    The mobile money wallet to charge. Send this or source_id, not both.

  • source_idstring

    A wallet already saved on the customer. Send this or source.

  • customer_idstring

    An existing customer to charge. Send this or customer.

  • capturedbooleanrequired

    Whether to immediately capture the charge or not.

  • invoice_reference_idstring

    Your own id for the bill this charge settles, echoed back on the charge. It does not create or settle a Leapa invoice.

  • customer_reference_idstring

    Your own id for the customer, echoed back on the charge so you can match it to your records.

  • otpstring

    The 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

application/json
  • idstring
  • objectstring
  • amountinteger<int64>
  • currencystring
    Allowed values:BIFUSDKESXAF
  • descriptionstring
  • statusstring
    Allowed values:succeededpaidpendingfailed
  • sourceSourceObject
  • affiliatestring
    Allowed values:dwelinn
  • amount_refundedinteger<int64>
  • available_dateinteger<int64>
  • capturedboolean
  • created_dateinteger<int64>
  • disputedboolean
  • failure_codestring
  • failure_messagestring
  • invoice_idstring
  • liveboolean
  • modified_dateinteger<int64>
  • refundedboolean
  • customer_idstring
  • processing_idstring
  • quittance_numberstring

Status codes

  • 201Created
  • 400Bad request
  • 401Unauthorized
  • 402Payment required
  • 403Forbidden
  • 404Not found
  • 428Precondition required
  • 500Server error

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"
}