@bytegigs/daraja 0.0.0-stage → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/NOTICE +14 -0
- package/README.md +76 -2
- package/dist/async-result.d.ts +47 -0
- package/dist/async-result.js +70 -0
- package/dist/callback.d.ts +26 -0
- package/dist/callback.js +44 -0
- package/dist/client.d.ts +219 -0
- package/dist/client.js +389 -0
- package/dist/credential.d.ts +7 -0
- package/dist/credential.js +20 -0
- package/dist/errors.d.ts +28 -0
- package/dist/errors.js +42 -0
- package/dist/generated/schema.d.ts +1049 -0
- package/dist/generated/schema.js +5 -0
- package/dist/helpers.d.ts +24 -0
- package/dist/helpers.js +100 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +7 -0
- package/dist/results.d.ts +3 -0
- package/dist/results.js +15 -0
- package/package.json +39 -4
|
@@ -0,0 +1,1049 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by openapi-typescript.
|
|
3
|
+
* Do not make direct changes to the file.
|
|
4
|
+
*/
|
|
5
|
+
export interface paths {
|
|
6
|
+
"/oauth/v1/generate": {
|
|
7
|
+
parameters: {
|
|
8
|
+
query?: never;
|
|
9
|
+
header?: never;
|
|
10
|
+
path?: never;
|
|
11
|
+
cookie?: never;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Generate an access token
|
|
15
|
+
* @description Returns a bearer token for the other Daraja APIs. Tokens last about one hour
|
|
16
|
+
* (`expires_in` is a string of seconds). Cache the token and reuse it until it is
|
|
17
|
+
* close to expiry instead of requesting one per call.
|
|
18
|
+
*/
|
|
19
|
+
get: operations["generateAccessToken"];
|
|
20
|
+
put?: never;
|
|
21
|
+
post?: never;
|
|
22
|
+
delete?: never;
|
|
23
|
+
options?: never;
|
|
24
|
+
head?: never;
|
|
25
|
+
patch?: never;
|
|
26
|
+
trace?: never;
|
|
27
|
+
};
|
|
28
|
+
"/mpesa/stkpush/v1/processrequest": {
|
|
29
|
+
parameters: {
|
|
30
|
+
query?: never;
|
|
31
|
+
header?: never;
|
|
32
|
+
path?: never;
|
|
33
|
+
cookie?: never;
|
|
34
|
+
};
|
|
35
|
+
get?: never;
|
|
36
|
+
put?: never;
|
|
37
|
+
/**
|
|
38
|
+
* Send an STK Push payment prompt
|
|
39
|
+
* @description Asks the customer to approve a payment on their phone. A `ResponseCode` of `"0"`
|
|
40
|
+
* means only that Daraja accepted the request; the payment result arrives later at
|
|
41
|
+
* your `CallBackURL`, or can be read with the STK Push Query.
|
|
42
|
+
*/
|
|
43
|
+
post: operations["stkPush"];
|
|
44
|
+
delete?: never;
|
|
45
|
+
options?: never;
|
|
46
|
+
head?: never;
|
|
47
|
+
patch?: never;
|
|
48
|
+
trace?: never;
|
|
49
|
+
};
|
|
50
|
+
"/mpesa/stkpushquery/v1/query": {
|
|
51
|
+
parameters: {
|
|
52
|
+
query?: never;
|
|
53
|
+
header?: never;
|
|
54
|
+
path?: never;
|
|
55
|
+
cookie?: never;
|
|
56
|
+
};
|
|
57
|
+
get?: never;
|
|
58
|
+
put?: never;
|
|
59
|
+
/**
|
|
60
|
+
* Check the result of an STK Push
|
|
61
|
+
* @description Returns the outcome of an STK Push. Use it to confirm a payment before you deliver,
|
|
62
|
+
* and to recover results whose callbacks never arrived. While the customer is still
|
|
63
|
+
* deciding, Daraja answers with an error (`errorCode` `500.001.1001`, "The
|
|
64
|
+
* transaction is being processed"); retry after a few seconds. Querying too
|
|
65
|
+
* often, or right after the push, returns HTTP 429: wait at least a few seconds
|
|
66
|
+
* before the first query and back off between queries.
|
|
67
|
+
*/
|
|
68
|
+
post: operations["stkPushQuery"];
|
|
69
|
+
delete?: never;
|
|
70
|
+
options?: never;
|
|
71
|
+
head?: never;
|
|
72
|
+
patch?: never;
|
|
73
|
+
trace?: never;
|
|
74
|
+
};
|
|
75
|
+
"/mpesa/c2b/v2/registerurl": {
|
|
76
|
+
parameters: {
|
|
77
|
+
query?: never;
|
|
78
|
+
header?: never;
|
|
79
|
+
path?: never;
|
|
80
|
+
cookie?: never;
|
|
81
|
+
};
|
|
82
|
+
get?: never;
|
|
83
|
+
put?: never;
|
|
84
|
+
/**
|
|
85
|
+
* Register C2B confirmation and validation URLs
|
|
86
|
+
* @description Tells M-PESA where to send customer payments made to your paybill or till
|
|
87
|
+
* from the M-PESA menu or app. Validation is off unless Safaricom enables it for
|
|
88
|
+
* your shortcode; `ResponseType` decides what happens if your validation URL
|
|
89
|
+
* does not answer. In production a shortcode's URLs can be registered once;
|
|
90
|
+
* changing them needs Safaricom's help. Daraja refuses URLs that contain words
|
|
91
|
+
* such as `mpesa`, `safaricom`, `exec`, `cmd` or `sql`, so keep them out of
|
|
92
|
+
* your paths. Daraja spells the response field `OriginatorCoversationID`,
|
|
93
|
+
* without the second "n".
|
|
94
|
+
*/
|
|
95
|
+
post: operations["c2bRegisterUrl"];
|
|
96
|
+
delete?: never;
|
|
97
|
+
options?: never;
|
|
98
|
+
head?: never;
|
|
99
|
+
patch?: never;
|
|
100
|
+
trace?: never;
|
|
101
|
+
};
|
|
102
|
+
"/mpesa/c2b/v2/simulate": {
|
|
103
|
+
parameters: {
|
|
104
|
+
query?: never;
|
|
105
|
+
header?: never;
|
|
106
|
+
path?: never;
|
|
107
|
+
cookie?: never;
|
|
108
|
+
};
|
|
109
|
+
get?: never;
|
|
110
|
+
put?: never;
|
|
111
|
+
/**
|
|
112
|
+
* Simulate a customer payment (sandbox only)
|
|
113
|
+
* @description Makes the sandbox send your confirmation (and validation) callbacks as if a
|
|
114
|
+
* customer had paid. Not available in production.
|
|
115
|
+
*/
|
|
116
|
+
post: operations["c2bSimulate"];
|
|
117
|
+
delete?: never;
|
|
118
|
+
options?: never;
|
|
119
|
+
head?: never;
|
|
120
|
+
patch?: never;
|
|
121
|
+
trace?: never;
|
|
122
|
+
};
|
|
123
|
+
"/mpesa/b2c/v3/paymentrequest": {
|
|
124
|
+
parameters: {
|
|
125
|
+
query?: never;
|
|
126
|
+
header?: never;
|
|
127
|
+
path?: never;
|
|
128
|
+
cookie?: never;
|
|
129
|
+
};
|
|
130
|
+
get?: never;
|
|
131
|
+
put?: never;
|
|
132
|
+
/**
|
|
133
|
+
* Send money from your shortcode to a customer
|
|
134
|
+
* @description Pays a customer's M-PESA account: salaries, refunds, winnings, loan
|
|
135
|
+
* disbursements. Needs a B2C shortcode and an API initiator. The result
|
|
136
|
+
* arrives later at `ResultURL`; a timeout at `QueueTimeOutURL`.
|
|
137
|
+
* `OriginatorConversationID` is yours: reuse it when retrying so you can match
|
|
138
|
+
* results and avoid paying twice.
|
|
139
|
+
*/
|
|
140
|
+
post: operations["b2cPayment"];
|
|
141
|
+
delete?: never;
|
|
142
|
+
options?: never;
|
|
143
|
+
head?: never;
|
|
144
|
+
patch?: never;
|
|
145
|
+
trace?: never;
|
|
146
|
+
};
|
|
147
|
+
"/mpesa/b2b/v1/paymentrequest": {
|
|
148
|
+
parameters: {
|
|
149
|
+
query?: never;
|
|
150
|
+
header?: never;
|
|
151
|
+
path?: never;
|
|
152
|
+
cookie?: never;
|
|
153
|
+
};
|
|
154
|
+
get?: never;
|
|
155
|
+
put?: never;
|
|
156
|
+
/**
|
|
157
|
+
* Pay another business's paybill or till
|
|
158
|
+
* @description Moves money from your shortcode to another business: a supplier's paybill
|
|
159
|
+
* (`BusinessPayBill`) or till (`BusinessBuyGoods`). The result arrives at
|
|
160
|
+
* `ResultURL`. Daraja spells `RecieverIdentifierType` this way.
|
|
161
|
+
*/
|
|
162
|
+
post: operations["b2bPayment"];
|
|
163
|
+
delete?: never;
|
|
164
|
+
options?: never;
|
|
165
|
+
head?: never;
|
|
166
|
+
patch?: never;
|
|
167
|
+
trace?: never;
|
|
168
|
+
};
|
|
169
|
+
"/mpesa/reversal/v1/request": {
|
|
170
|
+
parameters: {
|
|
171
|
+
query?: never;
|
|
172
|
+
header?: never;
|
|
173
|
+
path?: never;
|
|
174
|
+
cookie?: never;
|
|
175
|
+
};
|
|
176
|
+
get?: never;
|
|
177
|
+
put?: never;
|
|
178
|
+
/**
|
|
179
|
+
* Reverse a customer payment
|
|
180
|
+
* @description Asks M-PESA to reverse a payment your shortcode received, identified by its
|
|
181
|
+
* receipt (`TransactionID`). Only the full amount can be reversed. The result
|
|
182
|
+
* arrives at `ResultURL`.
|
|
183
|
+
*/
|
|
184
|
+
post: operations["reversal"];
|
|
185
|
+
delete?: never;
|
|
186
|
+
options?: never;
|
|
187
|
+
head?: never;
|
|
188
|
+
patch?: never;
|
|
189
|
+
trace?: never;
|
|
190
|
+
};
|
|
191
|
+
"/mpesa/transactionstatus/v1/query": {
|
|
192
|
+
parameters: {
|
|
193
|
+
query?: never;
|
|
194
|
+
header?: never;
|
|
195
|
+
path?: never;
|
|
196
|
+
cookie?: never;
|
|
197
|
+
};
|
|
198
|
+
get?: never;
|
|
199
|
+
put?: never;
|
|
200
|
+
/**
|
|
201
|
+
* Look up an M-PESA transaction
|
|
202
|
+
* @description Returns the details of a transaction by its receipt (`TransactionID`), or by
|
|
203
|
+
* `OriginatorConversationID` for a B2C payment whose receipt you never got. Use
|
|
204
|
+
* it to confirm C2B payments and to recover lost results. The answer arrives at
|
|
205
|
+
* `ResultURL`, not in the response.
|
|
206
|
+
*/
|
|
207
|
+
post: operations["transactionStatus"];
|
|
208
|
+
delete?: never;
|
|
209
|
+
options?: never;
|
|
210
|
+
head?: never;
|
|
211
|
+
patch?: never;
|
|
212
|
+
trace?: never;
|
|
213
|
+
};
|
|
214
|
+
"/mpesa/accountbalance/v1/query": {
|
|
215
|
+
parameters: {
|
|
216
|
+
query?: never;
|
|
217
|
+
header?: never;
|
|
218
|
+
path?: never;
|
|
219
|
+
cookie?: never;
|
|
220
|
+
};
|
|
221
|
+
get?: never;
|
|
222
|
+
put?: never;
|
|
223
|
+
/**
|
|
224
|
+
* Read your shortcode's balances
|
|
225
|
+
* @description Requests the balances of your shortcode's accounts. They arrive at
|
|
226
|
+
* `ResultURL` in the `AccountBalance` result parameter, as
|
|
227
|
+
* `Name|Currency|Amount|Reserved|Uncleared|Locked` groups separated by `&`.
|
|
228
|
+
*/
|
|
229
|
+
post: operations["accountBalance"];
|
|
230
|
+
delete?: never;
|
|
231
|
+
options?: never;
|
|
232
|
+
head?: never;
|
|
233
|
+
patch?: never;
|
|
234
|
+
trace?: never;
|
|
235
|
+
};
|
|
236
|
+
"/mpesa/qrcode/v1/generate": {
|
|
237
|
+
parameters: {
|
|
238
|
+
query?: never;
|
|
239
|
+
header?: never;
|
|
240
|
+
path?: never;
|
|
241
|
+
cookie?: never;
|
|
242
|
+
};
|
|
243
|
+
get?: never;
|
|
244
|
+
put?: never;
|
|
245
|
+
/**
|
|
246
|
+
* Generate an M-PESA payment QR code
|
|
247
|
+
* @description Returns a QR code that customers scan in the M-PESA app to pay a fixed amount
|
|
248
|
+
* to your paybill, till, agent or phone number. `QRCode` is a base64 PNG.
|
|
249
|
+
*/
|
|
250
|
+
post: operations["dynamicQr"];
|
|
251
|
+
delete?: never;
|
|
252
|
+
options?: never;
|
|
253
|
+
head?: never;
|
|
254
|
+
patch?: never;
|
|
255
|
+
trace?: never;
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
export type webhooks = Record<string, never>;
|
|
259
|
+
export interface components {
|
|
260
|
+
schemas: {
|
|
261
|
+
AccessToken: {
|
|
262
|
+
/** @description Bearer token for the other Daraja APIs. */
|
|
263
|
+
access_token: string;
|
|
264
|
+
/** @description Seconds until the token expires, as a string. */
|
|
265
|
+
expires_in: string;
|
|
266
|
+
};
|
|
267
|
+
Error: {
|
|
268
|
+
requestId?: string;
|
|
269
|
+
/** @description Daraja's error code, for example `400.002.02` or `500.001.1001`. */
|
|
270
|
+
errorCode: string;
|
|
271
|
+
errorMessage: string;
|
|
272
|
+
};
|
|
273
|
+
/** @description A paybill or till number. */
|
|
274
|
+
ShortCode: string;
|
|
275
|
+
/** @description A Kenyan mobile number in international format without the plus, e.g. `254708374149`. */
|
|
276
|
+
Msisdn: string;
|
|
277
|
+
/** @description The time of the request in Kenyan time (EAT), formatted `YYYYMMDDHHmmss`. */
|
|
278
|
+
Timestamp: string;
|
|
279
|
+
/** @description Base64 of `BusinessShortCode + Passkey + Timestamp`. */
|
|
280
|
+
StkPassword: string;
|
|
281
|
+
StkPushRequest: {
|
|
282
|
+
BusinessShortCode: components["schemas"]["ShortCode"];
|
|
283
|
+
Password: components["schemas"]["StkPassword"];
|
|
284
|
+
Timestamp: components["schemas"]["Timestamp"];
|
|
285
|
+
/**
|
|
286
|
+
* @description `CustomerPayBillOnline` for a paybill, `CustomerBuyGoodsOnline` for a till.
|
|
287
|
+
* @enum {string}
|
|
288
|
+
*/
|
|
289
|
+
TransactionType: "CustomerPayBillOnline" | "CustomerBuyGoodsOnline";
|
|
290
|
+
/** @description Whole Kenyan shillings. */
|
|
291
|
+
Amount: number;
|
|
292
|
+
PartyA: components["schemas"]["Msisdn"];
|
|
293
|
+
PartyB: components["schemas"]["ShortCode"];
|
|
294
|
+
PhoneNumber: components["schemas"]["Msisdn"];
|
|
295
|
+
/**
|
|
296
|
+
* Format: uri
|
|
297
|
+
* @description The public HTTPS URL that receives the result.
|
|
298
|
+
*/
|
|
299
|
+
CallBackURL: string;
|
|
300
|
+
/** @description Shown to the customer as the account number. Up to 12 characters. */
|
|
301
|
+
AccountReference: string;
|
|
302
|
+
/** @description A short note about the payment. Up to 13 characters. */
|
|
303
|
+
TransactionDesc: string;
|
|
304
|
+
};
|
|
305
|
+
StkPushResponse: {
|
|
306
|
+
MerchantRequestID: string;
|
|
307
|
+
/** @description Identifies this payment in the callback and the STK Push Query. */
|
|
308
|
+
CheckoutRequestID: string;
|
|
309
|
+
/** @description "0" means Daraja accepted the request. */
|
|
310
|
+
ResponseCode: string;
|
|
311
|
+
ResponseDescription: string;
|
|
312
|
+
CustomerMessage?: string;
|
|
313
|
+
};
|
|
314
|
+
StkPushQueryRequest: {
|
|
315
|
+
BusinessShortCode: components["schemas"]["ShortCode"];
|
|
316
|
+
Password: components["schemas"]["StkPassword"];
|
|
317
|
+
Timestamp: components["schemas"]["Timestamp"];
|
|
318
|
+
CheckoutRequestID: string;
|
|
319
|
+
};
|
|
320
|
+
StkPushQueryResponse: {
|
|
321
|
+
ResponseCode: string;
|
|
322
|
+
ResponseDescription: string;
|
|
323
|
+
MerchantRequestID: string;
|
|
324
|
+
CheckoutRequestID: string;
|
|
325
|
+
/** @description The payment result as a string. "0" means paid. See `StkResultCode`. */
|
|
326
|
+
ResultCode: string;
|
|
327
|
+
ResultDesc: string;
|
|
328
|
+
};
|
|
329
|
+
/**
|
|
330
|
+
* @description Common results. Daraja may return others; treat any non-zero code as not paid.
|
|
331
|
+
* - `0` paid
|
|
332
|
+
* - `1` insufficient balance
|
|
333
|
+
* - `1001` another transaction is in progress for this customer
|
|
334
|
+
* - `1019` the prompt expired
|
|
335
|
+
* - `1025` / `9999` Daraja could not send the prompt
|
|
336
|
+
* - `1032` the customer cancelled
|
|
337
|
+
* - `1037` the customer's phone could not be reached, or they did not respond
|
|
338
|
+
* - `2001` the customer entered the wrong PIN
|
|
339
|
+
*/
|
|
340
|
+
StkResultCode: number;
|
|
341
|
+
CallbackItem: {
|
|
342
|
+
/** @description `Amount`, `MpesaReceiptNumber`, `Balance`, `TransactionDate` or `PhoneNumber`. */
|
|
343
|
+
Name: string;
|
|
344
|
+
/** @description Missing for some items, such as `Balance`. `TransactionDate` and `PhoneNumber` arrive as numbers. */
|
|
345
|
+
Value?: string | number;
|
|
346
|
+
};
|
|
347
|
+
StkCallback: {
|
|
348
|
+
Body: {
|
|
349
|
+
stkCallback: {
|
|
350
|
+
MerchantRequestID: string;
|
|
351
|
+
CheckoutRequestID: string;
|
|
352
|
+
ResultCode: components["schemas"]["StkResultCode"];
|
|
353
|
+
ResultDesc: string;
|
|
354
|
+
CallbackMetadata?: {
|
|
355
|
+
Item: components["schemas"]["CallbackItem"][];
|
|
356
|
+
};
|
|
357
|
+
};
|
|
358
|
+
};
|
|
359
|
+
};
|
|
360
|
+
/** Format: uri */
|
|
361
|
+
HttpsUrl: string;
|
|
362
|
+
/** @description The API operator created on the M-PESA org portal. `testapi` in the sandbox. */
|
|
363
|
+
InitiatorName: string;
|
|
364
|
+
/**
|
|
365
|
+
* @description The initiator's password encrypted with Safaricom's public certificate
|
|
366
|
+
* (RSA, PKCS #1 v1.5 padding), base64-encoded. The sandbox and production use
|
|
367
|
+
* different certificates.
|
|
368
|
+
*/
|
|
369
|
+
SecurityCredential: string;
|
|
370
|
+
Remarks: string;
|
|
371
|
+
AsyncAccepted: {
|
|
372
|
+
ConversationID: string;
|
|
373
|
+
OriginatorConversationID: string;
|
|
374
|
+
/** @description "0" means Daraja queued the request. The outcome comes to `ResultURL`. */
|
|
375
|
+
ResponseCode: string;
|
|
376
|
+
ResponseDescription: string;
|
|
377
|
+
};
|
|
378
|
+
KeyValue: {
|
|
379
|
+
Key: string;
|
|
380
|
+
Value?: string | number;
|
|
381
|
+
};
|
|
382
|
+
AsyncResult: {
|
|
383
|
+
Result: {
|
|
384
|
+
ResultType: number;
|
|
385
|
+
/** @description 0 means success. Some APIs send it as a string. */
|
|
386
|
+
ResultCode: number | string;
|
|
387
|
+
ResultDesc: string;
|
|
388
|
+
OriginatorConversationID: string;
|
|
389
|
+
ConversationID: string;
|
|
390
|
+
TransactionID?: string;
|
|
391
|
+
ResultParameters?: {
|
|
392
|
+
/** @description One item or a list, depending on the API. */
|
|
393
|
+
ResultParameter?: components["schemas"]["KeyValue"][] | components["schemas"]["KeyValue"];
|
|
394
|
+
};
|
|
395
|
+
ReferenceData?: {
|
|
396
|
+
ReferenceItem?: components["schemas"]["KeyValue"][] | components["schemas"]["KeyValue"];
|
|
397
|
+
};
|
|
398
|
+
};
|
|
399
|
+
};
|
|
400
|
+
C2bRegisterUrlRequest: {
|
|
401
|
+
ShortCode: components["schemas"]["ShortCode"];
|
|
402
|
+
/**
|
|
403
|
+
* @description What M-PESA does when your validation URL doesn't answer in time.
|
|
404
|
+
* @enum {string}
|
|
405
|
+
*/
|
|
406
|
+
ResponseType: "Completed" | "Cancelled";
|
|
407
|
+
ConfirmationURL: components["schemas"]["HttpsUrl"];
|
|
408
|
+
ValidationURL: components["schemas"]["HttpsUrl"];
|
|
409
|
+
};
|
|
410
|
+
C2bRegisterUrlResponse: {
|
|
411
|
+
/** @description Spelled this way by Daraja. */
|
|
412
|
+
OriginatorCoversationID?: string;
|
|
413
|
+
ResponseCode: string;
|
|
414
|
+
ResponseDescription: string;
|
|
415
|
+
};
|
|
416
|
+
C2bSimulateRequest: {
|
|
417
|
+
ShortCode: components["schemas"]["ShortCode"];
|
|
418
|
+
/** @enum {string} */
|
|
419
|
+
CommandID: "CustomerPayBillOnline" | "CustomerBuyGoodsOnline";
|
|
420
|
+
Amount: number;
|
|
421
|
+
Msisdn: components["schemas"]["Msisdn"];
|
|
422
|
+
/** @description The account number. Leave out for a till. */
|
|
423
|
+
BillRefNumber?: string;
|
|
424
|
+
};
|
|
425
|
+
C2bTransaction: {
|
|
426
|
+
TransactionType: string;
|
|
427
|
+
/** @description The M-PESA receipt. */
|
|
428
|
+
TransID: string;
|
|
429
|
+
TransTime: components["schemas"]["Timestamp"];
|
|
430
|
+
/** @description Amount as a decimal string, e.g. `"250.00"`. */
|
|
431
|
+
TransAmount: string;
|
|
432
|
+
BusinessShortCode: string;
|
|
433
|
+
BillRefNumber?: string;
|
|
434
|
+
InvoiceNumber?: string;
|
|
435
|
+
OrgAccountBalance?: string;
|
|
436
|
+
ThirdPartyTransID?: string;
|
|
437
|
+
/** @description The payer's number. Recent Daraja versions mask or hash it. */
|
|
438
|
+
MSISDN?: string;
|
|
439
|
+
FirstName?: string;
|
|
440
|
+
MiddleName?: string;
|
|
441
|
+
LastName?: string;
|
|
442
|
+
};
|
|
443
|
+
C2bValidationResponse: {
|
|
444
|
+
/** @description "0" accepts. Rejection codes include `C2B00011` (invalid MSISDN), `C2B00012` (invalid account number), `C2B00013` (invalid amount) and `C2B00016` (other). */
|
|
445
|
+
ResultCode: string;
|
|
446
|
+
ResultDesc: string;
|
|
447
|
+
};
|
|
448
|
+
B2cRequest: {
|
|
449
|
+
/** @description Your unique ID for this payment. Reuse it on retries. */
|
|
450
|
+
OriginatorConversationID: string;
|
|
451
|
+
InitiatorName: components["schemas"]["InitiatorName"];
|
|
452
|
+
SecurityCredential: components["schemas"]["SecurityCredential"];
|
|
453
|
+
/** @enum {string} */
|
|
454
|
+
CommandID: "SalaryPayment" | "BusinessPayment" | "PromotionPayment";
|
|
455
|
+
/** @description Whole shillings. M-PESA's B2C minimum is KES 10. */
|
|
456
|
+
Amount: number;
|
|
457
|
+
PartyA: components["schemas"]["ShortCode"];
|
|
458
|
+
PartyB: components["schemas"]["Msisdn"];
|
|
459
|
+
Remarks: components["schemas"]["Remarks"];
|
|
460
|
+
QueueTimeOutURL: components["schemas"]["HttpsUrl"];
|
|
461
|
+
ResultURL: components["schemas"]["HttpsUrl"];
|
|
462
|
+
/** @description Optional. Spelled this way by Daraja. */
|
|
463
|
+
Occassion?: string;
|
|
464
|
+
};
|
|
465
|
+
B2bRequest: {
|
|
466
|
+
Initiator: components["schemas"]["InitiatorName"];
|
|
467
|
+
SecurityCredential: components["schemas"]["SecurityCredential"];
|
|
468
|
+
/** @enum {string} */
|
|
469
|
+
CommandID: "BusinessPayBill" | "BusinessBuyGoods";
|
|
470
|
+
/**
|
|
471
|
+
* @description "4" for a shortcode.
|
|
472
|
+
* @enum {string}
|
|
473
|
+
*/
|
|
474
|
+
SenderIdentifierType: "4";
|
|
475
|
+
/**
|
|
476
|
+
* @description Spelled this way by Daraja.
|
|
477
|
+
* @enum {string}
|
|
478
|
+
*/
|
|
479
|
+
RecieverIdentifierType: "4";
|
|
480
|
+
Amount: number;
|
|
481
|
+
PartyA: components["schemas"]["ShortCode"];
|
|
482
|
+
PartyB: components["schemas"]["ShortCode"];
|
|
483
|
+
AccountReference: string;
|
|
484
|
+
Requester?: components["schemas"]["Msisdn"];
|
|
485
|
+
Remarks: components["schemas"]["Remarks"];
|
|
486
|
+
QueueTimeOutURL: components["schemas"]["HttpsUrl"];
|
|
487
|
+
ResultURL: components["schemas"]["HttpsUrl"];
|
|
488
|
+
Occassion?: string;
|
|
489
|
+
};
|
|
490
|
+
ReversalRequest: {
|
|
491
|
+
Initiator: components["schemas"]["InitiatorName"];
|
|
492
|
+
SecurityCredential: components["schemas"]["SecurityCredential"];
|
|
493
|
+
/** @enum {string} */
|
|
494
|
+
CommandID: "TransactionReversal";
|
|
495
|
+
/** @description The M-PESA receipt of the payment to reverse. */
|
|
496
|
+
TransactionID: string;
|
|
497
|
+
Amount: number;
|
|
498
|
+
ReceiverParty: components["schemas"]["ShortCode"];
|
|
499
|
+
/**
|
|
500
|
+
* @description "11" for a reversal. Spelled this way by Daraja.
|
|
501
|
+
* @enum {string}
|
|
502
|
+
*/
|
|
503
|
+
RecieverIdentifierType: "11";
|
|
504
|
+
ResultURL: components["schemas"]["HttpsUrl"];
|
|
505
|
+
QueueTimeOutURL: components["schemas"]["HttpsUrl"];
|
|
506
|
+
Remarks: components["schemas"]["Remarks"];
|
|
507
|
+
Occasion?: string;
|
|
508
|
+
};
|
|
509
|
+
/** @description Send `TransactionID`, or `OriginatorConversationID` for a B2C payment whose receipt you never got. */
|
|
510
|
+
TransactionStatusRequest: {
|
|
511
|
+
Initiator: components["schemas"]["InitiatorName"];
|
|
512
|
+
SecurityCredential: components["schemas"]["SecurityCredential"];
|
|
513
|
+
/** @enum {string} */
|
|
514
|
+
CommandID: "TransactionStatusQuery";
|
|
515
|
+
/** @description The M-PESA receipt. Required unless you send `OriginatorConversationID`. */
|
|
516
|
+
TransactionID?: string;
|
|
517
|
+
/** @description The ID you gave a B2C payment, when you have no receipt. */
|
|
518
|
+
OriginatorConversationID?: string;
|
|
519
|
+
/** @description Your shortcode, or a phone number for `IdentifierType` "1". */
|
|
520
|
+
PartyA: string;
|
|
521
|
+
/**
|
|
522
|
+
* @description "1" phone number, "2" till, "4" shortcode.
|
|
523
|
+
* @enum {string}
|
|
524
|
+
*/
|
|
525
|
+
IdentifierType: "1" | "2" | "4";
|
|
526
|
+
ResultURL: components["schemas"]["HttpsUrl"];
|
|
527
|
+
QueueTimeOutURL: components["schemas"]["HttpsUrl"];
|
|
528
|
+
Remarks: components["schemas"]["Remarks"];
|
|
529
|
+
Occasion?: string;
|
|
530
|
+
};
|
|
531
|
+
AccountBalanceRequest: {
|
|
532
|
+
Initiator: components["schemas"]["InitiatorName"];
|
|
533
|
+
SecurityCredential: components["schemas"]["SecurityCredential"];
|
|
534
|
+
/** @enum {string} */
|
|
535
|
+
CommandID: "AccountBalance";
|
|
536
|
+
PartyA: components["schemas"]["ShortCode"];
|
|
537
|
+
/** @enum {string} */
|
|
538
|
+
IdentifierType: "2" | "4";
|
|
539
|
+
Remarks: components["schemas"]["Remarks"];
|
|
540
|
+
QueueTimeOutURL: components["schemas"]["HttpsUrl"];
|
|
541
|
+
ResultURL: components["schemas"]["HttpsUrl"];
|
|
542
|
+
};
|
|
543
|
+
DynamicQrRequest: {
|
|
544
|
+
MerchantName: string;
|
|
545
|
+
/** @description The account number or reference shown to the customer. */
|
|
546
|
+
RefNo: string;
|
|
547
|
+
Amount: number;
|
|
548
|
+
/**
|
|
549
|
+
* @description `BG` buy goods (till), `WA` agent withdrawal, `PB` paybill, `SM` send money to a phone number, `SB` send to a business.
|
|
550
|
+
* @enum {string}
|
|
551
|
+
*/
|
|
552
|
+
TrxCode: "BG" | "WA" | "PB" | "SM" | "SB";
|
|
553
|
+
/** @description The till, agent, paybill or phone number to pay. */
|
|
554
|
+
CPI: string;
|
|
555
|
+
/** @description Width and height of the image in pixels, as a string. */
|
|
556
|
+
Size: string;
|
|
557
|
+
};
|
|
558
|
+
DynamicQrResponse: {
|
|
559
|
+
ResponseCode: string;
|
|
560
|
+
RequestID?: string;
|
|
561
|
+
ResponseDescription: string;
|
|
562
|
+
/** @description A PNG image, base64-encoded. */
|
|
563
|
+
QRCode: string;
|
|
564
|
+
};
|
|
565
|
+
};
|
|
566
|
+
responses: {
|
|
567
|
+
/** @description Daraja queued the request. This is not the outcome: that arrives at `ResultURL`. */
|
|
568
|
+
AsyncAccepted: {
|
|
569
|
+
headers: {
|
|
570
|
+
[name: string]: unknown;
|
|
571
|
+
};
|
|
572
|
+
content: {
|
|
573
|
+
/**
|
|
574
|
+
* @example {
|
|
575
|
+
* "ConversationID": "AG_20261201_2010325b025970fbc403",
|
|
576
|
+
* "OriginatorConversationID": "6f2b8c1e-3c1d-4a8e-9a55-0d1bc7a2f001",
|
|
577
|
+
* "ResponseCode": "0",
|
|
578
|
+
* "ResponseDescription": "Accept the service request successfully."
|
|
579
|
+
* }
|
|
580
|
+
*/
|
|
581
|
+
"application/json": components["schemas"]["AsyncAccepted"];
|
|
582
|
+
};
|
|
583
|
+
};
|
|
584
|
+
/**
|
|
585
|
+
* @description Daraja's gateway is rate-limiting this app. Observed in the sandbox for an STK Push
|
|
586
|
+
* Query sent seconds after the STK Push (2026-12-01). The body does not follow the
|
|
587
|
+
* usual error shape, so read the status code, wait, and retry with backoff.
|
|
588
|
+
*/
|
|
589
|
+
RateLimited: {
|
|
590
|
+
headers: {
|
|
591
|
+
/** @description Seconds to wait, when Daraja sends it. */
|
|
592
|
+
"Retry-After"?: string;
|
|
593
|
+
[name: string]: unknown;
|
|
594
|
+
};
|
|
595
|
+
content?: never;
|
|
596
|
+
};
|
|
597
|
+
/**
|
|
598
|
+
* @description Daraja rejected the request. An HTTP 401 with "Invalid API call as no apiproduct
|
|
599
|
+
* match found" means your Daraja app does not have this API product enabled:
|
|
600
|
+
* add it to the app on the Daraja portal, then request a new access token.
|
|
601
|
+
*/
|
|
602
|
+
ErrorResponse: {
|
|
603
|
+
headers: {
|
|
604
|
+
[name: string]: unknown;
|
|
605
|
+
};
|
|
606
|
+
content: {
|
|
607
|
+
/**
|
|
608
|
+
* @example {
|
|
609
|
+
* "requestId": "4788-2930614-1",
|
|
610
|
+
* "errorCode": "400.002.02",
|
|
611
|
+
* "errorMessage": "Bad Request - Invalid BusinessShortCode"
|
|
612
|
+
* }
|
|
613
|
+
*/
|
|
614
|
+
"application/json": components["schemas"]["Error"];
|
|
615
|
+
};
|
|
616
|
+
};
|
|
617
|
+
};
|
|
618
|
+
parameters: never;
|
|
619
|
+
requestBodies: never;
|
|
620
|
+
headers: never;
|
|
621
|
+
pathItems: never;
|
|
622
|
+
}
|
|
623
|
+
export type $defs = Record<string, never>;
|
|
624
|
+
export interface operations {
|
|
625
|
+
generateAccessToken: {
|
|
626
|
+
parameters: {
|
|
627
|
+
query: {
|
|
628
|
+
grant_type: "client_credentials";
|
|
629
|
+
};
|
|
630
|
+
header?: never;
|
|
631
|
+
path?: never;
|
|
632
|
+
cookie?: never;
|
|
633
|
+
};
|
|
634
|
+
requestBody?: never;
|
|
635
|
+
responses: {
|
|
636
|
+
/** @description A new access token. */
|
|
637
|
+
200: {
|
|
638
|
+
headers: {
|
|
639
|
+
[name: string]: unknown;
|
|
640
|
+
};
|
|
641
|
+
content: {
|
|
642
|
+
/**
|
|
643
|
+
* @example {
|
|
644
|
+
* "access_token": "c9SQxWWhmdVRlyh0zh8gZDTkubVF",
|
|
645
|
+
* "expires_in": "3599"
|
|
646
|
+
* }
|
|
647
|
+
*/
|
|
648
|
+
"application/json": components["schemas"]["AccessToken"];
|
|
649
|
+
};
|
|
650
|
+
};
|
|
651
|
+
400: components["responses"]["ErrorResponse"];
|
|
652
|
+
401: components["responses"]["ErrorResponse"];
|
|
653
|
+
};
|
|
654
|
+
};
|
|
655
|
+
stkPush: {
|
|
656
|
+
parameters: {
|
|
657
|
+
query?: never;
|
|
658
|
+
header?: never;
|
|
659
|
+
path?: never;
|
|
660
|
+
cookie?: never;
|
|
661
|
+
};
|
|
662
|
+
requestBody: {
|
|
663
|
+
content: {
|
|
664
|
+
/**
|
|
665
|
+
* @example {
|
|
666
|
+
* "BusinessShortCode": "174379",
|
|
667
|
+
* "Password": "MTc0Mzc5YmZiMjc5ZjlhYTliZGJjZjE1OGU5N2RkNzFhNDY3Y2QyZTBjODkzMDU5YjEwZjc4ZTZiNzJhZGExZWQyYzkxOTIwMjYxMTMwMTAxMDAw",
|
|
668
|
+
* "Timestamp": "20261130101000",
|
|
669
|
+
* "TransactionType": "CustomerPayBillOnline",
|
|
670
|
+
* "Amount": 1,
|
|
671
|
+
* "PartyA": "254708374149",
|
|
672
|
+
* "PartyB": "174379",
|
|
673
|
+
* "PhoneNumber": "254708374149",
|
|
674
|
+
* "CallBackURL": "https://example.com/mpesa/callback",
|
|
675
|
+
* "AccountReference": "INV-1001",
|
|
676
|
+
* "TransactionDesc": "Invoice 1001"
|
|
677
|
+
* }
|
|
678
|
+
*/
|
|
679
|
+
"application/json": components["schemas"]["StkPushRequest"];
|
|
680
|
+
};
|
|
681
|
+
};
|
|
682
|
+
responses: {
|
|
683
|
+
/** @description Daraja accepted the request and sent the prompt. */
|
|
684
|
+
200: {
|
|
685
|
+
headers: {
|
|
686
|
+
[name: string]: unknown;
|
|
687
|
+
};
|
|
688
|
+
content: {
|
|
689
|
+
/**
|
|
690
|
+
* @example {
|
|
691
|
+
* "MerchantRequestID": "29115-34620561-1",
|
|
692
|
+
* "CheckoutRequestID": "ws_CO_30112026101000123708374149",
|
|
693
|
+
* "ResponseCode": "0",
|
|
694
|
+
* "ResponseDescription": "Success. Request accepted for processing",
|
|
695
|
+
* "CustomerMessage": "Success. Request accepted for processing"
|
|
696
|
+
* }
|
|
697
|
+
*/
|
|
698
|
+
"application/json": components["schemas"]["StkPushResponse"];
|
|
699
|
+
};
|
|
700
|
+
};
|
|
701
|
+
400: components["responses"]["ErrorResponse"];
|
|
702
|
+
401: components["responses"]["ErrorResponse"];
|
|
703
|
+
429: components["responses"]["RateLimited"];
|
|
704
|
+
500: components["responses"]["ErrorResponse"];
|
|
705
|
+
};
|
|
706
|
+
};
|
|
707
|
+
stkPushQuery: {
|
|
708
|
+
parameters: {
|
|
709
|
+
query?: never;
|
|
710
|
+
header?: never;
|
|
711
|
+
path?: never;
|
|
712
|
+
cookie?: never;
|
|
713
|
+
};
|
|
714
|
+
requestBody: {
|
|
715
|
+
content: {
|
|
716
|
+
/**
|
|
717
|
+
* @example {
|
|
718
|
+
* "BusinessShortCode": "174379",
|
|
719
|
+
* "Password": "MTc0Mzc5YmZiMjc5ZjlhYTliZGJjZjE1OGU5N2RkNzFhNDY3Y2QyZTBjODkzMDU5YjEwZjc4ZTZiNzJhZGExZWQyYzkxOTIwMjYxMTMwMTAxMDAw",
|
|
720
|
+
* "Timestamp": "20261130101000",
|
|
721
|
+
* "CheckoutRequestID": "ws_CO_30112026101000123708374149"
|
|
722
|
+
* }
|
|
723
|
+
*/
|
|
724
|
+
"application/json": components["schemas"]["StkPushQueryRequest"];
|
|
725
|
+
};
|
|
726
|
+
};
|
|
727
|
+
responses: {
|
|
728
|
+
/** @description The current result of the STK Push. */
|
|
729
|
+
200: {
|
|
730
|
+
headers: {
|
|
731
|
+
[name: string]: unknown;
|
|
732
|
+
};
|
|
733
|
+
content: {
|
|
734
|
+
/**
|
|
735
|
+
* @example {
|
|
736
|
+
* "ResponseCode": "0",
|
|
737
|
+
* "ResponseDescription": "The service request has been accepted successsfully",
|
|
738
|
+
* "MerchantRequestID": "29115-34620561-1",
|
|
739
|
+
* "CheckoutRequestID": "ws_CO_30112026101000123708374149",
|
|
740
|
+
* "ResultCode": "0",
|
|
741
|
+
* "ResultDesc": "The service request is processed successfully."
|
|
742
|
+
* }
|
|
743
|
+
*/
|
|
744
|
+
"application/json": components["schemas"]["StkPushQueryResponse"];
|
|
745
|
+
};
|
|
746
|
+
};
|
|
747
|
+
400: components["responses"]["ErrorResponse"];
|
|
748
|
+
401: components["responses"]["ErrorResponse"];
|
|
749
|
+
429: components["responses"]["RateLimited"];
|
|
750
|
+
500: components["responses"]["ErrorResponse"];
|
|
751
|
+
};
|
|
752
|
+
};
|
|
753
|
+
c2bRegisterUrl: {
|
|
754
|
+
parameters: {
|
|
755
|
+
query?: never;
|
|
756
|
+
header?: never;
|
|
757
|
+
path?: never;
|
|
758
|
+
cookie?: never;
|
|
759
|
+
};
|
|
760
|
+
requestBody: {
|
|
761
|
+
content: {
|
|
762
|
+
/**
|
|
763
|
+
* @example {
|
|
764
|
+
* "ShortCode": "600984",
|
|
765
|
+
* "ResponseType": "Completed",
|
|
766
|
+
* "ConfirmationURL": "https://example.com/payments/c2b/confirmation",
|
|
767
|
+
* "ValidationURL": "https://example.com/payments/c2b/validation"
|
|
768
|
+
* }
|
|
769
|
+
*/
|
|
770
|
+
"application/json": components["schemas"]["C2bRegisterUrlRequest"];
|
|
771
|
+
};
|
|
772
|
+
};
|
|
773
|
+
responses: {
|
|
774
|
+
/** @description The URLs were registered. */
|
|
775
|
+
200: {
|
|
776
|
+
headers: {
|
|
777
|
+
[name: string]: unknown;
|
|
778
|
+
};
|
|
779
|
+
content: {
|
|
780
|
+
/**
|
|
781
|
+
* @example {
|
|
782
|
+
* "OriginatorCoversationID": "7619-37765134-1",
|
|
783
|
+
* "ResponseCode": "0",
|
|
784
|
+
* "ResponseDescription": "success"
|
|
785
|
+
* }
|
|
786
|
+
*/
|
|
787
|
+
"application/json": components["schemas"]["C2bRegisterUrlResponse"];
|
|
788
|
+
};
|
|
789
|
+
};
|
|
790
|
+
400: components["responses"]["ErrorResponse"];
|
|
791
|
+
401: components["responses"]["ErrorResponse"];
|
|
792
|
+
500: components["responses"]["ErrorResponse"];
|
|
793
|
+
};
|
|
794
|
+
};
|
|
795
|
+
c2bSimulate: {
|
|
796
|
+
parameters: {
|
|
797
|
+
query?: never;
|
|
798
|
+
header?: never;
|
|
799
|
+
path?: never;
|
|
800
|
+
cookie?: never;
|
|
801
|
+
};
|
|
802
|
+
requestBody: {
|
|
803
|
+
content: {
|
|
804
|
+
/**
|
|
805
|
+
* @example {
|
|
806
|
+
* "ShortCode": "600984",
|
|
807
|
+
* "CommandID": "CustomerPayBillOnline",
|
|
808
|
+
* "Amount": 250,
|
|
809
|
+
* "Msisdn": "254708374149",
|
|
810
|
+
* "BillRefNumber": "INV-1001"
|
|
811
|
+
* }
|
|
812
|
+
*/
|
|
813
|
+
"application/json": components["schemas"]["C2bSimulateRequest"];
|
|
814
|
+
};
|
|
815
|
+
};
|
|
816
|
+
responses: {
|
|
817
|
+
/** @description The simulated payment was accepted. */
|
|
818
|
+
200: {
|
|
819
|
+
headers: {
|
|
820
|
+
[name: string]: unknown;
|
|
821
|
+
};
|
|
822
|
+
content: {
|
|
823
|
+
/**
|
|
824
|
+
* @example {
|
|
825
|
+
* "OriginatorCoversationID": "53e3-4aa8-9fe0-8fb5e4092cdd3405976",
|
|
826
|
+
* "ResponseCode": "0",
|
|
827
|
+
* "ResponseDescription": "Accept the service request successfully."
|
|
828
|
+
* }
|
|
829
|
+
*/
|
|
830
|
+
"application/json": components["schemas"]["C2bRegisterUrlResponse"];
|
|
831
|
+
};
|
|
832
|
+
};
|
|
833
|
+
400: components["responses"]["ErrorResponse"];
|
|
834
|
+
401: components["responses"]["ErrorResponse"];
|
|
835
|
+
500: components["responses"]["ErrorResponse"];
|
|
836
|
+
};
|
|
837
|
+
};
|
|
838
|
+
b2cPayment: {
|
|
839
|
+
parameters: {
|
|
840
|
+
query?: never;
|
|
841
|
+
header?: never;
|
|
842
|
+
path?: never;
|
|
843
|
+
cookie?: never;
|
|
844
|
+
};
|
|
845
|
+
requestBody: {
|
|
846
|
+
content: {
|
|
847
|
+
/**
|
|
848
|
+
* @example {
|
|
849
|
+
* "OriginatorConversationID": "6f2b8c1e-3c1d-4a8e-9a55-0d1bc7a2f001",
|
|
850
|
+
* "InitiatorName": "testapi",
|
|
851
|
+
* "SecurityCredential": "EsJocK7+NjqZPC3I3EO+TbvS+xVb9TymWwaKABoaZr/Z/n0UysSs..",
|
|
852
|
+
* "CommandID": "BusinessPayment",
|
|
853
|
+
* "Amount": 100,
|
|
854
|
+
* "PartyA": "600996",
|
|
855
|
+
* "PartyB": "254708374149",
|
|
856
|
+
* "Remarks": "Refund INV-1001",
|
|
857
|
+
* "QueueTimeOutURL": "https://example.com/mpesa/b2c/timeout",
|
|
858
|
+
* "ResultURL": "https://example.com/mpesa/b2c/result",
|
|
859
|
+
* "Occassion": "Refund"
|
|
860
|
+
* }
|
|
861
|
+
*/
|
|
862
|
+
"application/json": components["schemas"]["B2cRequest"];
|
|
863
|
+
};
|
|
864
|
+
};
|
|
865
|
+
responses: {
|
|
866
|
+
200: components["responses"]["AsyncAccepted"];
|
|
867
|
+
400: components["responses"]["ErrorResponse"];
|
|
868
|
+
401: components["responses"]["ErrorResponse"];
|
|
869
|
+
500: components["responses"]["ErrorResponse"];
|
|
870
|
+
};
|
|
871
|
+
};
|
|
872
|
+
b2bPayment: {
|
|
873
|
+
parameters: {
|
|
874
|
+
query?: never;
|
|
875
|
+
header?: never;
|
|
876
|
+
path?: never;
|
|
877
|
+
cookie?: never;
|
|
878
|
+
};
|
|
879
|
+
requestBody: {
|
|
880
|
+
content: {
|
|
881
|
+
/**
|
|
882
|
+
* @example {
|
|
883
|
+
* "Initiator": "testapi",
|
|
884
|
+
* "SecurityCredential": "EsJocK7+NjqZPC3I3EO+TbvS+xVb9TymWwaKABoaZr/Z/n0UysSs..",
|
|
885
|
+
* "CommandID": "BusinessPayBill",
|
|
886
|
+
* "SenderIdentifierType": "4",
|
|
887
|
+
* "RecieverIdentifierType": "4",
|
|
888
|
+
* "Amount": 1000,
|
|
889
|
+
* "PartyA": "600992",
|
|
890
|
+
* "PartyB": "600000",
|
|
891
|
+
* "AccountReference": "SUP-2201",
|
|
892
|
+
* "Requester": "254708374149",
|
|
893
|
+
* "Remarks": "Stock for December",
|
|
894
|
+
* "QueueTimeOutURL": "https://example.com/mpesa/b2b/timeout",
|
|
895
|
+
* "ResultURL": "https://example.com/mpesa/b2b/result"
|
|
896
|
+
* }
|
|
897
|
+
*/
|
|
898
|
+
"application/json": components["schemas"]["B2bRequest"];
|
|
899
|
+
};
|
|
900
|
+
};
|
|
901
|
+
responses: {
|
|
902
|
+
200: components["responses"]["AsyncAccepted"];
|
|
903
|
+
400: components["responses"]["ErrorResponse"];
|
|
904
|
+
401: components["responses"]["ErrorResponse"];
|
|
905
|
+
500: components["responses"]["ErrorResponse"];
|
|
906
|
+
};
|
|
907
|
+
};
|
|
908
|
+
reversal: {
|
|
909
|
+
parameters: {
|
|
910
|
+
query?: never;
|
|
911
|
+
header?: never;
|
|
912
|
+
path?: never;
|
|
913
|
+
cookie?: never;
|
|
914
|
+
};
|
|
915
|
+
requestBody: {
|
|
916
|
+
content: {
|
|
917
|
+
/**
|
|
918
|
+
* @example {
|
|
919
|
+
* "Initiator": "testapi",
|
|
920
|
+
* "SecurityCredential": "EsJocK7+NjqZPC3I3EO+TbvS+xVb9TymWwaKABoaZr/Z/n0UysSs..",
|
|
921
|
+
* "CommandID": "TransactionReversal",
|
|
922
|
+
* "TransactionID": "TKU3XXXXXX",
|
|
923
|
+
* "Amount": 250,
|
|
924
|
+
* "ReceiverParty": "600984",
|
|
925
|
+
* "RecieverIdentifierType": "11",
|
|
926
|
+
* "ResultURL": "https://example.com/mpesa/reversal/result",
|
|
927
|
+
* "QueueTimeOutURL": "https://example.com/mpesa/reversal/timeout",
|
|
928
|
+
* "Remarks": "Paid twice"
|
|
929
|
+
* }
|
|
930
|
+
*/
|
|
931
|
+
"application/json": components["schemas"]["ReversalRequest"];
|
|
932
|
+
};
|
|
933
|
+
};
|
|
934
|
+
responses: {
|
|
935
|
+
200: components["responses"]["AsyncAccepted"];
|
|
936
|
+
400: components["responses"]["ErrorResponse"];
|
|
937
|
+
401: components["responses"]["ErrorResponse"];
|
|
938
|
+
500: components["responses"]["ErrorResponse"];
|
|
939
|
+
};
|
|
940
|
+
};
|
|
941
|
+
transactionStatus: {
|
|
942
|
+
parameters: {
|
|
943
|
+
query?: never;
|
|
944
|
+
header?: never;
|
|
945
|
+
path?: never;
|
|
946
|
+
cookie?: never;
|
|
947
|
+
};
|
|
948
|
+
requestBody: {
|
|
949
|
+
content: {
|
|
950
|
+
/**
|
|
951
|
+
* @example {
|
|
952
|
+
* "Initiator": "testapi",
|
|
953
|
+
* "SecurityCredential": "EsJocK7+NjqZPC3I3EO+TbvS+xVb9TymWwaKABoaZr/Z/n0UysSs..",
|
|
954
|
+
* "CommandID": "TransactionStatusQuery",
|
|
955
|
+
* "TransactionID": "TKU3XXXXXX",
|
|
956
|
+
* "PartyA": "600984",
|
|
957
|
+
* "IdentifierType": "4",
|
|
958
|
+
* "ResultURL": "https://example.com/mpesa/status/result",
|
|
959
|
+
* "QueueTimeOutURL": "https://example.com/mpesa/status/timeout",
|
|
960
|
+
* "Remarks": "Confirm payment"
|
|
961
|
+
* }
|
|
962
|
+
*/
|
|
963
|
+
"application/json": components["schemas"]["TransactionStatusRequest"];
|
|
964
|
+
};
|
|
965
|
+
};
|
|
966
|
+
responses: {
|
|
967
|
+
200: components["responses"]["AsyncAccepted"];
|
|
968
|
+
400: components["responses"]["ErrorResponse"];
|
|
969
|
+
401: components["responses"]["ErrorResponse"];
|
|
970
|
+
500: components["responses"]["ErrorResponse"];
|
|
971
|
+
};
|
|
972
|
+
};
|
|
973
|
+
accountBalance: {
|
|
974
|
+
parameters: {
|
|
975
|
+
query?: never;
|
|
976
|
+
header?: never;
|
|
977
|
+
path?: never;
|
|
978
|
+
cookie?: never;
|
|
979
|
+
};
|
|
980
|
+
requestBody: {
|
|
981
|
+
content: {
|
|
982
|
+
/**
|
|
983
|
+
* @example {
|
|
984
|
+
* "Initiator": "testapi",
|
|
985
|
+
* "SecurityCredential": "EsJocK7+NjqZPC3I3EO+TbvS+xVb9TymWwaKABoaZr/Z/n0UysSs..",
|
|
986
|
+
* "CommandID": "AccountBalance",
|
|
987
|
+
* "PartyA": "600984",
|
|
988
|
+
* "IdentifierType": "4",
|
|
989
|
+
* "Remarks": "Daily balance",
|
|
990
|
+
* "QueueTimeOutURL": "https://example.com/mpesa/balance/timeout",
|
|
991
|
+
* "ResultURL": "https://example.com/mpesa/balance/result"
|
|
992
|
+
* }
|
|
993
|
+
*/
|
|
994
|
+
"application/json": components["schemas"]["AccountBalanceRequest"];
|
|
995
|
+
};
|
|
996
|
+
};
|
|
997
|
+
responses: {
|
|
998
|
+
200: components["responses"]["AsyncAccepted"];
|
|
999
|
+
400: components["responses"]["ErrorResponse"];
|
|
1000
|
+
401: components["responses"]["ErrorResponse"];
|
|
1001
|
+
500: components["responses"]["ErrorResponse"];
|
|
1002
|
+
};
|
|
1003
|
+
};
|
|
1004
|
+
dynamicQr: {
|
|
1005
|
+
parameters: {
|
|
1006
|
+
query?: never;
|
|
1007
|
+
header?: never;
|
|
1008
|
+
path?: never;
|
|
1009
|
+
cookie?: never;
|
|
1010
|
+
};
|
|
1011
|
+
requestBody: {
|
|
1012
|
+
content: {
|
|
1013
|
+
/**
|
|
1014
|
+
* @example {
|
|
1015
|
+
* "MerchantName": "Mama Mboga Online",
|
|
1016
|
+
* "RefNo": "INV-1001",
|
|
1017
|
+
* "Amount": 250,
|
|
1018
|
+
* "TrxCode": "PB",
|
|
1019
|
+
* "CPI": "174379",
|
|
1020
|
+
* "Size": "300"
|
|
1021
|
+
* }
|
|
1022
|
+
*/
|
|
1023
|
+
"application/json": components["schemas"]["DynamicQrRequest"];
|
|
1024
|
+
};
|
|
1025
|
+
};
|
|
1026
|
+
responses: {
|
|
1027
|
+
/** @description The QR code. */
|
|
1028
|
+
200: {
|
|
1029
|
+
headers: {
|
|
1030
|
+
[name: string]: unknown;
|
|
1031
|
+
};
|
|
1032
|
+
content: {
|
|
1033
|
+
/**
|
|
1034
|
+
* @example {
|
|
1035
|
+
* "ResponseCode": "AG_20191219_000043fdf61864fe9ff5",
|
|
1036
|
+
* "RequestID": "16738-27456357-1",
|
|
1037
|
+
* "ResponseDescription": "QR Code Successfully Generated.",
|
|
1038
|
+
* "QRCode": "iVBORw0KGgoAAAANSUhEUgAAASwAAAEsAQAAAABRBrPYAAAD"
|
|
1039
|
+
* }
|
|
1040
|
+
*/
|
|
1041
|
+
"application/json": components["schemas"]["DynamicQrResponse"];
|
|
1042
|
+
};
|
|
1043
|
+
};
|
|
1044
|
+
400: components["responses"]["ErrorResponse"];
|
|
1045
|
+
401: components["responses"]["ErrorResponse"];
|
|
1046
|
+
500: components["responses"]["ErrorResponse"];
|
|
1047
|
+
};
|
|
1048
|
+
};
|
|
1049
|
+
}
|