Skip to content

Card Collections

Lipila provides payments by Visa and Master Cards.

Description

This endpoint is used to initiate a card collection.

Headers

The following headers should be added to your request.

HeaderTypeDescriptionRequired
acceptapplication/jsonExpected response formatYes
Content-Typeapplication/jsonContent type of the request bodyYes
x-api-keystringYour Lipila API keyYes
callbackUrlstringURL to receive asynchronous callback notificationsOptional

Request Body

The following properties should be present in your request body.

FieldTypeDescriptionRequired
firstNamestringCustomer's first nameYes
lastNamestringCustomer's last nameYes
phoneNumberstringCustomer's phone numberYes
referenceIdstringUnique reference identifier for the transaction.Yes
amountnumberAmount to collectYes
accountNumberstringCard number or account identifier to collect fromYes
currencystringCurrency code (e.g., ZMW)Yes
emailstringCustomer's email addressYes
narrationstringCustomer's email addressYes
citystringCustomer's cityYes
countrystringCustomer's country code e.g. ZMYes
addressstringCustomer's addressYes
zipstringCustomer's postal/zip codeYes
backUrlstringURL to navigate back to after unsuccessful paymentYes
redirectUrlstringURL to redirect customer after paymentYes

Example Request

js

curl -X 'POST' \
  'https://api.lipila.dev/api/v1/collections/card' \
  -H 'accept: application/json' \
  -H 'callbackUrl: https://lipila.io/callback' \
  -H 'x-api-key: Your_secret_key' \
  -H 'Content-Type: application/json' \
  -d '{
  "customerInfo": {
    "firstName": "John",
    "lastName": "Doe",
    "phoneNumber": "260xxxxxxxxxx",
    "city": "lusaka",
    "country": "ZM",
    "address": "Matero plot number 23423",
    "zip": "10101",
    "email": "test@gmail.com"
  },
  "collectionRequest": {
    "referenceId": "43174606b87e", // Use this Id to check the transaction status
    "amount": 1,
    "narration": "test",
    "accountNumber": "260xxxxxxxxxx",
    "currency": "ZMW",
    "backUrl": "https://www.test.com/",
    "redirectUrl": "https://www.test.com/"
  }
}'

Example Successful Response

Below is a successful response from the above request.

HTTP Status CodeDescription
200SUCCESS
js
  {
  "currency": "ZMW",
  "amount": 1,
  "accountNumber": "test@gmail.com",
  "status": "Pending",
  "paymentType": "Card",
  "ipAddress": "::1",
  "cardRedirectionUrl": "https://secure.3gdirectpay.com/payv2.php?ID=7400B9C3-CB89-41E4-9C49-9B5031EE847A",
  "createdAt": "2026-02-05T10:01:16.568522+00:00",
  "referenceId": "12345678909876543345678", 
  "identifier": "LPLXC-20260205-100116-3102"
  }

INFO

You have successfully initiated a card payment but this is not the end. Your response should have a cardRedirectionUrl just like the above example. When you open this url you will be redirected to a page where you enter your card details. After you submit your card details you will receive confirmation from your bank to approve this payment. This will determine the status of your transaction. Make sure your card is either a master card or visa.

Error Codes

The following are the expected error responses from the api.

HTTP Status CodeError CodeDescription
400BAD REQUESTMissing or invalid request parameters
401UNAUTHORIZEDMissing or invalid API authentication
403FORBIDDENAccess denied to this resource, verify your keys
403FORBIDDENAccess denied to this resource, verify your keys
429TOO MANY REQUESTSRate limit exceeded, slow down requests

Released under the MIT License.