Skip to content
iSmartPayDevelopers
Esc
↑↓navigate↵open⌘Jpreview

Collect money from a payer

Asks a payer to approve a payment into your wallet. The amount is a decimal string in major units, for example "120.00".

A 202 means the collection was accepted, not that it has settled. The payer approves on their phone or bank app, so settlement happens later. Read GET /v1/collections/{reference} until status is settled, failed or expired, or subscribe to webhooks from the developer console.

The reference is yours: it must be unique for each collection you start. Send a required Idempotency-Key header, and repeat it unchanged when you retry. After a timeout or a 5xx, retry with the same key and body rather than starting a new collection. Requires the collections.write permission.

To ask another iSmartPay account for money, set provider to ismartpay and name the payer by handle or msisdn. Nothing moves until the payer approves in iSmartPay. A person approves in the iSmartPay app or the iSmartPay Business console. A developer console business cannot approve or decline yet, so a request sent to one ends only by being cancelled or expiring. The request ends expired when expiresIn runs out, failed with failureReason declined when the payer says no, and failed with cancelled when you cancel it with POST /v1/collections/{reference}/cancel. A handle or number with no iSmartPay account looks the same as a request the payer ignores. Your own account needs a payable handle to send requests.

POST/v1/collections
Authorization
AuthorizationBearer token (JWT) · headerrequired

A token from POST /v1/oauth/token on the iSmartPay identity service, obtained with an API credential's client id and secret.

Header parameters
Idempotency-Keystringrequired

A unique value you generate for this attempt, at most 255 characters. Send the same value when you retry the same request: it is answered once, however many times you send it. Reusing a value with a different body is refused with 409 idempotency_key_reused.

min length 1 · max length 255
Request body
requiredapplication/json
referencestringrequired

Your own identifier for this request, 1 to 64 letters, digits, underscores or hyphens, starting with a letter or digit. It must be unique for each request you start.

matches ^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$
amountstringrequired

The amount to collect. A decimal string in major units.

currencystringrequired

Three-letter currency code.

matches ^[A-Z]{3}$
providerstringrequired

The mobile money provider, for example mtn or telecel. Use ismartpay to send a payment request to another iSmartPay account instead of prompting a mobile money payer; the payer then answers inside iSmartPay. List what your account can use with GET /v1/payment-methods.

payerobjectrequired
Show properties
typestringrequired

What kind of account the payer is. For provider ismartpay use handle or msisdn; handle works only with ismartpay.

Allowed:msisdnaccountcardhandle
valuestringrequired

The mobile money number, account number, card reference or iSmartPay handle, for example @kofi_foods.

notestring

Optional text stored with the record. At most 50 characters, no control characters. It is not sent to the provider.

max length 50
expiresIninteger

Only for provider ismartpay. How many seconds the payer has to answer before the request expires. Defaults to 900 (15 minutes). By default iSmartPay accepts 60 to 86400 (24 hours) and answers 400 with the allowed range otherwise. Refused on any other provider.

walletIdstring<uuid>

One of your wallets, by id. Your primary wallet when left out. A closed wallet is 422 wallet_closed; an id that is not yours is 404. Not taken with provider ismartpay: a payment request is paid into your primary wallet.

Responses
202

Accepted. The collection has not settled yet.

referencestringrequired

The reference you chose.

amountstring

The requested amount. A decimal string in major units.

currencystring

Three-letter currency code.

matches ^[A-Z]{3}$
statusstringrequired

Where the request stands, reported as it is: accepted, dispatched, in_review, held, settled, failed or expired. Others can appear, so do not treat this list as closed. A payment request ends failed when the payer declines or you cancel it, and expired when nobody answers in time.

providerstring

The provider used.

feestring

The fee charged. Left out when none was recorded. A decimal string in major units.

feeBearerstring

Who pays the fee. initiator: the party who starts the request pays the amount plus the fee, and the recipient gets the full amount. non_initiator: the fee comes out of what the recipient gets.

Allowed:initiatornon_initiator
payerAmountstring

What the payer is charged. Left out when the fee bearer is not known. A decimal string in major units.

recipientAmountstring

What the recipient receives. Left out when the fee bearer is not known. A decimal string in major units.

notestring

The note you sent.

failureReasonstring

Why it failed. For a payment request: declined, cancelled or expired. For other providers, the provider's own reason when there is one. Left out otherwise.

createdAtstring<date-time>
completedAtstring<date-time>

When it reached its final status. Left out while it is still moving, and on older movements where the time was not recorded.

expiresAtstring<date-time>

Payment requests only. When an open request ends expired. Left out on other collections.

channelstring

How it was started. api is the only value today.

Allowed:api
settlementStatusstring

Where the money stands with settlement: not_eligible, eligible, claimed or settled.

Allowed:not_eligibleeligibleclaimedsettled
reconciliationReconciliation

What the platform's check against the provider concluded.

Show properties
statusstringrequired

unchecked (not checked yet), matched (the provider agrees) or mismatched (the provider disagrees; the platform is looking into it).

Allowed:uncheckedmatchedmismatched
checkedAtstring<date-time>

When it was last checked. Left out until it has been.

parentLineageLink

The movement this one undoes, when it is a reversal. Left out otherwise.

Show properties
typestringrequired

What kind of movement it is.

Allowed:collectionpayoutwallet_transfer
referencestringrequired

Its reference.

compensationLineageLink

The reversal recorded against this movement. Left out when there is none.

Show properties
typestringrequired

What kind of movement it is.

Allowed:collectionpayoutwallet_transfer
referencestringrequired

Its reference.

walletIdstring<uuid>

The wallet the money went into or came out of, when one was named.

400

The request is not valid. message says which field.

errorobjectrequired
Show properties
codestringrequired

A stable, machine-readable code. Branch on this, not on the message. Codes include invalid_input, unauthenticated, forbidden, environment_mismatch, not_found, rate_limited, idempotency_key_reused, request_in_flight, limits_missing, limits_unusable, tier_ineligible, transaction_limit_exceeded, daily_limit_exceeded, monthly_limit_exceeded, new_destination_limit, business_suspended, business_deactivated, environment_unknown, duplicate_reference, provider_error, provider_timeout, destination_not_verified, destination_verification_unavailable, upstream_timeout and internal.

messagestringrequired

Readable detail for a person. For any 5xx it is always the fixed text internal server error.

401

The token is missing, expired or not valid. Get a new one from the token endpoint.

errorobjectrequired
Show properties
codestringrequired

A stable, machine-readable code. Branch on this, not on the message. Codes include invalid_input, unauthenticated, forbidden, environment_mismatch, not_found, rate_limited, idempotency_key_reused, request_in_flight, limits_missing, limits_unusable, tier_ineligible, transaction_limit_exceeded, daily_limit_exceeded, monthly_limit_exceeded, new_destination_limit, business_suspended, business_deactivated, environment_unknown, duplicate_reference, provider_error, provider_timeout, destination_not_verified, destination_verification_unavailable, upstream_timeout and internal.

messagestringrequired

Readable detail for a person. For any 5xx it is always the fixed text internal server error.

403

The request was understood and refused. Common causes: the token is not an API credential's (forbidden); the credential is for the other environment (environment_mismatch); it does not have the permission this operation needs (forbidden); a limit was reached (limits_missing, limits_unusable, tier_ineligible, transaction_limit_exceeded, daily_limit_exceeded, monthly_limit_exceeded, new_destination_limit); or iSmartPay has suspended or deactivated the business (business_suspended, business_deactivated). A suspended business's API credentials stop exchanging for tokens, so a request made with a token issued just before the suspension is refused with business_suspended.

errorobjectrequired
Show properties
codestringrequired

A stable, machine-readable code. Branch on this, not on the message. Codes include invalid_input, unauthenticated, forbidden, environment_mismatch, not_found, rate_limited, idempotency_key_reused, request_in_flight, limits_missing, limits_unusable, tier_ineligible, transaction_limit_exceeded, daily_limit_exceeded, monthly_limit_exceeded, new_destination_limit, business_suspended, business_deactivated, environment_unknown, duplicate_reference, provider_error, provider_timeout, destination_not_verified, destination_verification_unavailable, upstream_timeout and internal.

messagestringrequired

Readable detail for a person. For any 5xx it is always the fixed text internal server error.

404

Nothing was found with that reference or number. For utilities, product_not_found means no product has that productId.

errorobjectrequired
Show properties
codestringrequired

A stable, machine-readable code. Branch on this, not on the message. Codes include invalid_input, unauthenticated, forbidden, environment_mismatch, not_found, rate_limited, idempotency_key_reused, request_in_flight, limits_missing, limits_unusable, tier_ineligible, transaction_limit_exceeded, daily_limit_exceeded, monthly_limit_exceeded, new_destination_limit, business_suspended, business_deactivated, environment_unknown, duplicate_reference, provider_error, provider_timeout, destination_not_verified, destination_verification_unavailable, upstream_timeout and internal.

messagestringrequired

Readable detail for a person. For any 5xx it is always the fixed text internal server error.

409

idempotency_key_reused: the key was used before with a different body. request_in_flight: a request with this key is still being processed, so retry shortly. duplicate_reference: the reference is already used by a different request, so choose a new one; sending the same body again under a new key replays the first answer.

errorobjectrequired
Show properties
codestringrequired

A stable, machine-readable code. Branch on this, not on the message. Codes include invalid_input, unauthenticated, forbidden, environment_mismatch, not_found, rate_limited, idempotency_key_reused, request_in_flight, limits_missing, limits_unusable, tier_ineligible, transaction_limit_exceeded, daily_limit_exceeded, monthly_limit_exceeded, new_destination_limit, business_suspended, business_deactivated, environment_unknown, duplicate_reference, provider_error, provider_timeout, destination_not_verified, destination_verification_unavailable, upstream_timeout and internal.

messagestringrequired

Readable detail for a person. For any 5xx it is always the fixed text internal server error.

422

A payment request cannot be sent: requester_handle_required (your business has no payable handle) or payer_is_requester (the payer is your own account).

errorobjectrequired
Show properties
codestringrequired

A stable, machine-readable code. Branch on this, not on the message. Codes include invalid_input, unauthenticated, forbidden, environment_mismatch, not_found, rate_limited, idempotency_key_reused, request_in_flight, limits_missing, limits_unusable, tier_ineligible, transaction_limit_exceeded, daily_limit_exceeded, monthly_limit_exceeded, new_destination_limit, business_suspended, business_deactivated, environment_unknown, duplicate_reference, provider_error, provider_timeout, destination_not_verified, destination_verification_unavailable, upstream_timeout and internal.

messagestringrequired

Readable detail for a person. For any 5xx it is always the fixed text internal server error.

429

request_limit_reached when a payment request goes over a sending limit (per minute, per payer open at once, or per payer per day), with no Retry-After; the message says which limit. Otherwise too many requests for this credential: wait the number of seconds in the Retry-After header, then try again.

errorobjectrequired
Show properties
codestringrequired

A stable, machine-readable code. Branch on this, not on the message. Codes include invalid_input, unauthenticated, forbidden, environment_mismatch, not_found, rate_limited, idempotency_key_reused, request_in_flight, limits_missing, limits_unusable, tier_ineligible, transaction_limit_exceeded, daily_limit_exceeded, monthly_limit_exceeded, new_destination_limit, business_suspended, business_deactivated, environment_unknown, duplicate_reference, provider_error, provider_timeout, destination_not_verified, destination_verification_unavailable, upstream_timeout and internal.

messagestringrequired

Readable detail for a person. For any 5xx it is always the fixed text internal server error.

500

Something failed on our side. The message is fixed. If the request was a POST, retry with the same Idempotency-Key and body.

errorobjectrequired
Show properties
codestringrequired

A stable, machine-readable code. Branch on this, not on the message. Codes include invalid_input, unauthenticated, forbidden, environment_mismatch, not_found, rate_limited, idempotency_key_reused, request_in_flight, limits_missing, limits_unusable, tier_ineligible, transaction_limit_exceeded, daily_limit_exceeded, monthly_limit_exceeded, new_destination_limit, business_suspended, business_deactivated, environment_unknown, duplicate_reference, provider_error, provider_timeout, destination_not_verified, destination_verification_unavailable, upstream_timeout and internal.

messagestringrequired

Readable detail for a person. For any 5xx it is always the fixed text internal server error.

502

A service behind the API did not answer usably. If the request was a POST, retry with the same Idempotency-Key and body. A party lookup the provider rejects is provider_error.

errorobjectrequired
Show properties
codestringrequired

A stable, machine-readable code. Branch on this, not on the message. Codes include invalid_input, unauthenticated, forbidden, environment_mismatch, not_found, rate_limited, idempotency_key_reused, request_in_flight, limits_missing, limits_unusable, tier_ineligible, transaction_limit_exceeded, daily_limit_exceeded, monthly_limit_exceeded, new_destination_limit, business_suspended, business_deactivated, environment_unknown, duplicate_reference, provider_error, provider_timeout, destination_not_verified, destination_verification_unavailable, upstream_timeout and internal.

messagestringrequired

Readable detail for a person. For any 5xx it is always the fixed text internal server error.

503

The API is temporarily unable to tell which environment it serves (environment_unknown), utility purchases are not available right now (utilities_unavailable), a settlement destination could not be name-checked just now (destination_verification_unavailable; retry the same request), or hosted checkout is not set up on this deployment (checkout_unavailable). Retry shortly, except for checkout_unavailable, which lasts until the deployment is configured.

errorobjectrequired
Show properties
codestringrequired

A stable, machine-readable code. Branch on this, not on the message. Codes include invalid_input, unauthenticated, forbidden, environment_mismatch, not_found, rate_limited, idempotency_key_reused, request_in_flight, limits_missing, limits_unusable, tier_ineligible, transaction_limit_exceeded, daily_limit_exceeded, monthly_limit_exceeded, new_destination_limit, business_suspended, business_deactivated, environment_unknown, duplicate_reference, provider_error, provider_timeout, destination_not_verified, destination_verification_unavailable, upstream_timeout and internal.

messagestringrequired

Readable detail for a person. For any 5xx it is always the fixed text internal server error.

504

The request took too long. If it was a POST, its outcome is unknown: retry with the same Idempotency-Key and body, or read it back by reference. A party lookup the provider does not answer is provider_timeout: check again before relying on it.

errorobjectrequired
Show properties
codestringrequired

A stable, machine-readable code. Branch on this, not on the message. Codes include invalid_input, unauthenticated, forbidden, environment_mismatch, not_found, rate_limited, idempotency_key_reused, request_in_flight, limits_missing, limits_unusable, tier_ineligible, transaction_limit_exceeded, daily_limit_exceeded, monthly_limit_exceeded, new_destination_limit, business_suspended, business_deactivated, environment_unknown, duplicate_reference, provider_error, provider_timeout, destination_not_verified, destination_verification_unavailable, upstream_timeout and internal.

messagestringrequired

Readable detail for a person. For any 5xx it is always the fixed text internal server error.

Request
curl -X POST 'https://stgdeveloper-api.ismartghana.com/v1/collections' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Idempotency-Key: string' \
  -H 'Content-Type: application/json' \
  -d '{
  "reference": "string",
  "amount": "120.00",
  "currency": "GHS",
  "provider": "string",
  "payer": {
    "type": "msisdn",
    "value": "string"
  },
  "note": "string",
  "expiresIn": 3600,
  "walletId": "0ecad4a2-3549-43fb-807e-9ff033247480"
}'
Response
{
  "reference": "string",
  "amount": "120.00",
  "currency": "GHS",
  "status": "string",
  "provider": "string",
  "fee": "120.00",
  "feeBearer": "initiator",
  "payerAmount": "120.00",
  "recipientAmount": "120.00",
  "note": "string",
  "failureReason": "string",
  "createdAt": "2019-08-24T14:15:22Z",
  "completedAt": "2019-08-24T14:15:22Z",
  "expiresAt": "2019-08-24T14:15:22Z",
  "channel": "api",
  "settlementStatus": "not_eligible",
  "reconciliation": {
    "status": "unchecked",
    "checkedAt": "2019-08-24T14:15:22Z"
  },
  "parent": {
    "type": "collection",
    "reference": "string"
  },
  "compensation": {
    "type": "collection",
    "reference": "string"
  },
  "walletId": "0ecad4a2-3549-43fb-807e-9ff033247480"
}