Skip to content

Collection API

Introduction

Djamo’s payment solution lets you receive payments from Djamo users.

Whether you're integrating payments into a website, mobile app, or custom checkout system, our flexible APIs give you full control over the experience while keeping transactions smooth and secure.

The Charge API

The Charge API allows you to collect payments from customers. A charge represents a payment request that a Djamo user can pay.

Think of a charge as a digital invoice that you create and send to your customer. When they pay this invoice, the money gets transferred to your Djamo business account.

Create a charge

POST /v1/charges

This endpoint creates a payment request for your customer.

Parameter Required Type Description
amount YES Amount How much money to collect. Example: 10000
externalId YES String Your own reference ID for this transaction. Example: SF32JTK3DEO478WNF
description YES String What the payment is for. Example: Shoe payment
onCanceledRedirectionUrl YES String Merchant URL to redirect the user after canceled payment. Exemple: https://www.merchant.com/djamo-cancel/1744728413766
onCompletedRedirectionUrl YES String Merchant URL to redirect the user after completed payment. Exemple: https://www.merchant.com/djamo-sucess/1744728413766
metadata No Object Any extra information you want to store with this charge. Example: { "catalogId": "3DW24FTG" }
curl --request POST \
--url <BASE_URL>/v1/charges \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'X-Company-Id: <YOUR_COMPANY_ID>' \
--data '{
  "amount": 10000,
  "externalId": "12182912",
  "description": "Product purchase",
  "metadata": {
    "purchaseReference": "00DDAAEESDS"
  },
  "onCanceledRedirectionUrl": "https://www.merchant.com/djamo-success/1744728413766",
  "onCompletedRedirectionUrl": "https://www.merchant.com/djamo-cancel/1744728413766"
}'
{
  "id": "20c8a4c5822c-43dd-967c-e0619fb5da46",
  "createdAt": "20250128T083908.249Z",
  "externalId": "12182912",
  "description": "Product purchase",
  "currency": "XOF",
  "amount": 10000,
  "due": 10000,
  "fees": {
    "currency": "XOF",
    "rate": 1,
    "value": 100
  },
  "status": "created",
  "paid": 0,
  "refunded": 0,
  "attempts": 0,
  "metadata": {
    "purchaseReference": "00DDAAEESDS"
  },
  "paymentUrl": "<https://djamo.ci/?type=payment_confirmation>...",
  "transactions": []
}

The most important part of this response is the paymentUrl. This is the link you need to redirect your customer to or share with them so they can complete the payment.

Warning

Make sure to subscribe to the webhook topic charge/events to receive status updates about your charges.

Error responses

HTTP code Cause
400 Missing or invalid parameter (amount, externalId, description, onCanceledRedirectionUrl, onCompletedRedirectionUrl).
401 Invalid or missing access token.
422 An unexpected error occurred. Contact support if the issue persists.

For general HTTP error codes, see Handling errors.

Pay a charge (Staging)

POST /v1/charges/:id/pay

Danger

This only works in staging. Do not try in production. It wouldn't work anyways.

This endpoint simulates paying for a charge. You can use the following numbers to simulate different statuses:

Phone Number Desired Status
2250747000000 paid
2251212121205 failed
curl --request POST \
--url <BASE_URL>/v1/charges/:id/pay \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data '{
  "recipientMsisdn": <TEST_PHONE_NUMBER>
}'
{
  "id": "bf6db759-9933-446f-be08-749d553bcb86",
  "createdAt": "2025-07-29T12:22:26.568Z",
  "externalId": "174473164430-",
  "description": "Product purchase",
  "currency": "XOF",
  "amount": 100,
  "due": 0,
  "fees": {
    "currency": "XOF",
    "rate": 1,
    "value": 1
  },
  "status": "paid",
  "droppedReason": null,
  "paid": 100,
  "refunded": 0,
  "attempts": 1,
  "metadata": {},
  "transactions": [
    {
      "id": "DJAMONEXUSMDOIC4S0CV8I5GOY7R",
      "recipientMsisdn": "2250747000000",
      "providerTransactionReference": "DJAMONEXUSMQ6CAMB8WVF9AOKIY7",
      "amount": 100,
      "service": "djamo",
      "status": "completed",
      "type": "payment",
      "error": null
    }
  ],
  "webRedirectionUrl": "https://www.yumyum.sn/djamo-cancel/1744728413766"
}

Error responses

HTTP code Cause
401 Invalid or missing access token.
404 Charge not found.

For general HTTP error codes, see Handling errors.

Retrieve a charge

GET /v1/charges/:id

This endpoint lets you check the status of a charge - whether it's been paid, how much was paid, etc.

curl -X GET "<BASE_URL>/v1/charges/:id" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY"
{
  "id": "89448bf6-291d-42d7-b928-6cb466280bb7",
  "createdAt": "2026-06-09T07:49:20.474Z",
  "externalId": "1001",
  "description": "Paiement effectué chez TOTO Corp",
  "currency": "XOF",
  "amount": 100,
  "due": 0,
  "fees": {
    "currency": "XOF",
    "rate": 1,
    "value": 1
  },
  "status": "paid",
  "droppedReason": null,
  "paid": 100,
  "refunded": 0,
  "attempts": 1,
  "metadata": {},
  "transactions": [
    {
      "id": "DJAMONEXUSMQ6CAM1ALD8G2DGZ9C",
      "recipientMsisdn": "225xxxxxxxx",
      "providerTransactionReference": "DJAMONEXUSMQ6CAMB8WVF9AOKIY7",
      "amount": 100,
      "service": "djamo",
      "status": "completed",
      "type": "payment",
      "error": null
    }
  ]
}

Error responses

HTTP code Cause
401 Invalid or missing access token.
404 Charge not found.

For general HTTP error codes, see Handling errors.

This is useful for checking if your customer has completed their payment. The status field will be one of:

Status Description
due The charge is created but not paid yet
paid The charge has been paid successfully
refunded The charge was paid but has been refunded
refunded_partially The charge was paid and part of it has been refunded
dropped The charge was abandoned or canceled

Charge status flow

The time-to-live of a due charge is 1 hour. This means that if no successful transaction occurs, the charge will remain in the due status for one hour after its creation. Once this period has elapsed, the due charge is automatically marked as dropped. A webhook is triggered on the charge/events topic whenever a charge transitions to either the paid or dropped status.

graph LR
    start(charge created) --> due(due<br/>TTL: 1 hour)
    due -->|Transaction successful<br/>within 1 hour| paid(paid)
    due -->|TTL expired<br/>after 1 hour| dropped(dropped)

    paid --> webhook(Webhook<br/>charge/events<br/>)
    dropped --> webhook

    paid -->|Refund issued| refunded(refunded)
    paid -->|Partial refund issued| refundedpartially(refunded_partially)
    refundedpartially --> webhook
    refunded --> webhook

    style start stroke-width:2px
    style due fill:#FFF9C4,stroke:#F9A825,stroke-width:3px
    style paid fill:#C8E6C9,stroke:#388E3C,stroke-width:3px
    style dropped fill:#FFCDD2,stroke:#D32F2F,stroke-width:3px
    style refunded fill:#E1BEE7,stroke:#7B1FA2,stroke-width:3px
    style refundedpartially fill:#E1BEE7,stroke:#7B1FA2,stroke-width:3px
    style webhook stroke-width:2px

List charges

GET /v1/charges

This endpoint lists the charges you created through the API, most recent first. It is meant for occasional reconciliation: to follow the status of your charges, subscribe to the webhook topic charge/events, and to look up a single charge, use Retrieve a charge.

Parameter Required Type Description
limit YES Integer Number of charges to return per page, between 1 and 100.
cursor No String Pagination cursor. Use the cursor.next or cursor.prev value from a previous response.
curl -X GET "<BASE_URL>/v1/charges?limit=15" \
  -H "Authorization: Bearer YOUR_API_KEY"
{
  "limit": 15,
  "cursor": {
    "prev": null,
    "next": null
  },
  "data": [
    {
      "id": "89448bf6-291d-42d7-b928-6cb466280bb7",
      "createdAt": "2026-11-12T07:49:20.474Z",
      "externalId": "1002",
      "description": "Product purchase",
      "currency": "XOF",
      "amount": 100,
      "due": 0,
      "fees": {
        "currency": "XOF",
        "rate": 1,
        "value": 1
      },
      "status": "paid",
      "droppedReason": null,
      "paid": 100,
      "refunded": 0,
      "attempts": 1,
      "metadata": {}
    },
    {
      "id": "bf6db759-9933-446f-be08-749d553bcb86",
      "createdAt": "2026-11-03T12:22:26.568Z",
      "externalId": "1001",
      "description": "Product purchase",
      "currency": "XOF",
      "amount": 5000,
      "due": 0,
      "fees": {
        "currency": "XOF",
        "rate": 1,
        "value": 50
      },
      "status": "paid",
      "droppedReason": null,
      "paid": 5000,
      "refunded": 0,
      "attempts": 1,
      "metadata": {}
    }
  ]
}

The response is paginated:

Attribute Type Description
limit Integer Maximum number of charges per page.
cursor.next String Cursor to fetch the next page. null when there are no more charges.
cursor.prev String Cursor to fetch the previous page. null on the first page.
data Array The charges of the current page.

To go through all your charges, repeat the request with cursor set to the cursor.next value of the previous response, until cursor.next is null.

Rate limit

This endpoint is limited to 30 requests per minute per company. Beyond that, requests are rejected with a 429 until the current one-minute window ends.

Error responses

HTTP code Cause
400 Missing or invalid query parameter (limit, cursor), or the charges could not be listed (CHARGE_LIST_FAILED).
401 Invalid or missing access token.
429 Rate limit exceeded (TOO_MANY_ATTEMPTS): more than 30 requests in the current one-minute window. Wait before retrying.

For general HTTP error codes, see Handling errors.

Refund a charge

POST /v1/charges/:id/refund

This endpoint lets you send money back to a customer who has already paid.

Note

If you don't include an amount, the entire charge will be refunded. If you do include an amount, you can refund just part of the charge (useful if you're giving a partial refund).

Partial refund

curl -X POST \
  <BASE_URL>/v1/charges/:id/refund \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "amount": 10000
  }'

Full refund

curl -X POST \
  <BASE_URL>/v1/charges/:id/refund \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{}'
{
  "id": "bfad6e0a-eba5-4fa9-b477-7bc0d3ce2c01",
  "createdAt": "2025-10-30T11:30:32.075Z",
  "externalId": "SF32JTK3DEO478WNH",
  "description": "Product purchase",
  "currency": "XOF",
  "amount": 100,
  "due": 0,
  "fees": {
    "currency": "XOF",
    "rate": 1,
    "value": 1
  },
  "status": "refunded",
  "droppedReason": null,
  "paid": 100,
  "refunded": 100,
  "attempts": 2,
  "metadata": {},
  "transactions": [
    {
      "id": "DJAMONEXUSMHDD73FAN8KPSXIZ83",
      "recipientMsisdn": "2250747000000",
      "amount": 100,
      "service": "djamo",
      "status": "completed",
      "type": "refund",
      "error": null
    },
    {
      "id": "DJAMONEXUSMHDCJ7XGJSFSQZERIWE",
      "recipientMsisdn": "2250747000000",
      "amount": 100,
      "service": "djamo",
      "status": "completed",
      "type": "payment",
      "error": null
    }
  ]
}

Error responses

HTTP code Cause
400 Invalid refund amount (exceeds the amount paid).
401 Invalid or missing access token.
404 Charge not found.
422 An unexpected error occurred. Contact support if the issue persists.

For general HTTP error codes, see Handling errors.