Products · Dash API
Payments
Take a payment in Dash's own payment sheet, by linked account, card or mobile money, and read it back later.
dash.payments.request
dash.payments.request(options: PaymentOptions, callOptions?: PaymentCallOptions): DashRequest<PaymentResult>Opens Dash's payment sheet, where the person pays for order with one of methods. The money goes to the Space that owns the dot.
Before the person picks a method, it can reject with:
invalid: Monime won't take the order, such as one below its smallest amount.denied: the dot or its Space can't take payments now, or this dot's payment sheet is already open. The open sheet carries on.failed: Dash couldn't reach Monime.cancelled: the person closed the sheet.timeout: the sheet waited as long as Dash allows.
Once they pick a method, it resolves with the payment's status: completed, pending, expired, or cancelled if they closed the sheet. If a method fails, the sheet stays open for them to try again. From then on, cancel() only stops your code waiting; the payment goes on. Read it again later with get.
Permission in dot.json: payments.
Types: PaymentOptions, PaymentCallOptions, PaymentResult
dash.payments.get
dash.payments.get(reference: string, callOptions?: CallOptions): DashRequest<PaymentResult | undefined>The payment for the order with this reference, to check a pending one later or after the dot opens again. Undefined if this dot never asked for it, or the person never picked a method.
Permission in dot.json: payments.
Types: PaymentResult
Types
Money
| Field | Type | What it is |
|---|---|---|
currency | 'SLE' | 'USD' | |
value | number | In minor units, as in Monime's API: SLE 75.00 is 7500. |
OrderLineItem
| Field | Type | What it is |
|---|---|---|
name | string | |
unitPrice | Money | |
quantity (optional) | number | 1 to 100,000. Default: 1. |
imageUrl (optional) | string | An https picture Dash shows beside the item. Its host must be in network.hosts in dot.json. |
Order
| Field | Type | What it is |
|---|---|---|
name | string | What the person is paying for, such as "Jazz Night tickets". 3 to 64 characters. |
reference | string | The dot's own ID for the order, up to 64 characters. The same reference never pays twice: asking again gives back the first payment. |
description (optional) | string | |
lineItems | OrderLineItem[] | 1 to 16 items, all in one currency. Dash adds them up for the total. |
metadata (optional) | Record<string, string> | Up to 64 pairs, with keys up to 48 characters and values up to 100. They stay with the payment and its webhooks. Keys can't start with "@", "_" or "monime", which Monime keeps for itself. |
MomoProvider
Monime's IDs for the mobile money providers: m17 is Orange Money and m18 is Africell Money.
type MomoProvider = 'm17' | 'm18';LinkProvider
Monime's IDs for the banks a linked account can be at.
type LinkProvider = 'slb001' | 'slb004' | 'slb007' | 'slb009' | 'slb013';LinkMethod
| Field | Type | What it is |
|---|---|---|
type | 'link' | |
providers (optional) | LinkProvider[] | The only banks that can pay. Empty or left out means any. |
CardMethod
| Field | Type | What it is |
|---|---|---|
type | 'card' |
MomoMethod
| Field | Type | What it is |
|---|---|---|
type | 'momo' | |
providers (optional) | MomoProvider[] | The only providers that can pay. Empty or left out means both. |
phoneNumber (optional) | string | Only this number can pay, such as "+23276123456". |
PaymentMethod
type PaymentMethod = LinkMethod | CardMethod | MomoMethod;Types: LinkMethod, CardMethod, MomoMethod
PaymentOptions
| Field | Type | What it is |
|---|---|---|
order | Order | |
methods (optional) | PaymentMethod[] | The methods to offer, in order, each with its own settings. Leave it out for all three with no limits. |
financialAccountId (optional) | string | The financial account the money goes to, such as "fac-k6VgVTfSmLruHpiQgMg4DUeySZx". It must belong to the Space that owns the dot and hold the order's currency. Leave it out for the Space's main account. |
PaymentStatus
failed comes only from get, for a pending payment that failed later.
type PaymentStatus = 'pending' | 'completed' | 'failed' | 'expired' | 'cancelled';CardPaymentResult
Also has the fields of PaymentResultBase.
| Field | Type | What it is |
|---|---|---|
method | 'card' | |
checkoutSessionId | string | The Monime checkout session the card paid through. |
MomoPaymentResult
Also has the fields of PaymentResultBase.
| Field | Type | What it is |
|---|---|---|
method | 'momo' | |
paymentCodeId | string | The Monime payment code the mobile money paid through. |
LinkPaymentResult
Also has the fields of PaymentResultBase.
| Field | Type | What it is |
|---|---|---|
method | 'link' | |
paymentId | string | The Monime payment the linked account made. |
PaymentResult
type PaymentResult = CardPaymentResult | MomoPaymentResult | LinkPaymentResult;Types: CardPaymentResult, MomoPaymentResult, LinkPaymentResult
PaymentCallOptions
No timeout: Dash decides how long the sheet waits.
type PaymentCallOptions = Omit<CallOptions, 'timeout'>;Types: CallOptions
PaymentResultBase
| Field | Type | What it is |
|---|---|---|
reference | string | The order's reference. |
requestId | string | Dash's ID for the payment request. Give it to Monime's support when asking about a payment. |
status | PaymentStatus | How the payment stands now. |
amount | Money | The order's total. |
paymentId (optional) | string | Monime's payment, such as "pay-…", once there is one. |
orderNumber (optional) | string | Monime's number for the order, for the person's receipt and for support. Only once the payment has completed. |