Interface: CreateOrderPayload
Defined in: packages/pesa/src/types/order.ts:53
Payload for creating a payment order.
Pass this to PesaInstance.createOrder to initiate a payment. The SDK validates required fields before forwarding to the provider.
Example
const order = await pesa.createOrder({
amount: 15000,
currency: 'TZS',
reference: 'order_abc123',
customer: {
name: 'Juma Ali',
phone: '255712345678',
email: '[email protected]',
},
description: 'Monthly subscription',
});Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
amount | number | Amount in whole TZS. 15000 = TZS 15,000. Must be > 0. | packages/pesa/src/types/order.ts:55 |
currency | "TZS" | Currency code. Currently only 'TZS'. | packages/pesa/src/types/order.ts:57 |
customer | { email?: string; name: string; phone: string; } | Customer details. | packages/pesa/src/types/order.ts:66 |
customer.email? | string | Customer's email address (optional). | packages/pesa/src/types/order.ts:75 |
customer.name | string | Customer's full name. | packages/pesa/src/types/order.ts:68 |
customer.phone | string | Mobile money phone number in MSISDN format: 255XXXXXXXXX. Local formats like 07XX are rejected. | packages/pesa/src/types/order.ts:73 |
description? | string | Optional human-readable description of the order. | packages/pesa/src/types/order.ts:64 |
metadata? | Record<string, unknown> | Arbitrary metadata attached to the order. | packages/pesa/src/types/order.ts:83 |
redirectUrl? | string | Required for redirect-based providers (DPO, Pesapal). URL the customer is sent to after completing payment. | packages/pesa/src/types/order.ts:81 |
reference | string | Your internal order identifier. Must be unique. Used for idempotency — the same reference won't be charged twice. | packages/pesa/src/types/order.ts:62 |