mpesa@1.2.1
- buyGoods(data, options)
- checkTransactionStatus(data, options)
- registerUrl(data, options)
- remitTax(data, options)
- request(method, path, body, options)
- stkPush(data, options)
This adaptor exports the following from common:
- as()
- combine()
- cursor()
- dataPath()
- dataValue()
- dateFns
- each()
- field()
- fields()
- fn()
- lastReferenceValue()
- log()
- merge()
- sourceValue()
Functions
buyGoods
buyGoods(data, options) ⇒ Operation
Pay for goods and services directly from your business account to a till number, merchant store number or Merchant HO
| Param | Type | Description |
|---|---|---|
| data | BuyGoodsObject | The object that will be attached to the POST request body |
| options | RequestOptions | Optional request object. Includes headers, error mappings and query params |
This operation writes the following keys to state:
| State Key | Description |
|---|---|
| data | the parsed response body |
| response | the response from the DARAJA API server (excluding the body) |
| references | an array of all previous data objects used in the Job |
Example: Pay for goods
buyGoods({
"Initiator": "testapi",
"SecurityCredential": "sbMXpuhMX5LzieNiDrx9TgscfaBxxvie0WlBDdGli4MWu4s5gbhYVlBy+T89xHQdoYwcG202KNp403ln2dLFnytPqw==",
"Amount": 1,
"PartyA": 600999,
"PartyB": 600000,
"AccountReference": 353353,
"Requester": 254708374149,
"Remarks": "ok",
"QueueTimeOutURL": "https://mydomain.com/b2b/queue/",
"ResultURL": "https://mydomain.com/b2b/result/"
});
checkTransactionStatus
checkTransactionStatus(data, options) ⇒ Operation
Check the status of the transaction
| Param | Type | Description |
|---|---|---|
| data | TransactionStatusObject | The object that will be attached to the POST request body |
| options | RequestOptions | Optional request object. Includes headers, error mappings and query params |
This operation writes the following keys to state:
| State Key | Description |
|---|---|
| data | the parsed response body |
| response | the response from the DARAJA API server (excluding the body) |
| references | an array of all previous data objects used in the Job |
Example: Check status of a transaction
checkTransactionStatus({
"Initiator": "testapi",
"SecurityCredential": "ctHDk+dN14A22B5GyQQvISSTY3K1tVnCTuQGoG7PsTCadzTkl5wz44Rhpkb0BZDvfRA==",
"TransactionID": "OEI2AK4Q16",
"PartyA": 600998,
"IdentifierType": 4,
"ResultURL": "https://mydomain.com/TransactionStatus/result/",
"QueueTimeOutURL": "https://mydomain.com/TransactionStatus/queue/",
"Remarks": "fdfdfdfdf",
"Occassion": "null",
});