Logo Lanfrica

OpenFn/language-mpesa

Domaine:

digital infrastructure

Type de record:

software
Créateur:
Ope
Hôte:
A language-pack for working with the MPESA api # Language MPESA Language Pack for building expressions and operations to interact with Safaricom's MPESA mobile money system. ***Consider github.com, but it's es6*** ## Likely order of operations: ### 1. register a validation/confirmation URL (to receive C2B notifiactions) This is probably done via the CLI: ``` registerUrl("openfn.org"); ``` ### 2. request a payment from a customer (B2C) sample `expression.js` ```js requestPayment({ InitiatorName: 'testapi402', // This is the credential/username used to authenticate the transaction request. - SecurityCredential: 'Safaricom111!', // Base64 encoded string of the Security Credential, which is encrypted using M-Pesa public key and validates the transaction on M-Pesa Core system. (Defaults to credential value.) CommandID: '', // Unique command for each transaction type e.g. SalaryPayment, BusinessPayment, PromotionPayment Amount: '', // The amount being transacted PartyA: '601402', // Organization’s shortcode initiating the transaction. (Defaults to credential value.) PartyB: '', // Phone number receiving the transaction Remarks: 'OpenFn test.', // Comments that are sent along with the transaction. QueueTimeOutURL: '', // The timeout end-point that receives a timeout. (Defaults to credential value.) ResultURL: '', // The end-point that receives the response of the transaction. (Defaults to credential value.) Occassion: '', // Optional }); ``` ### 3. receive payment notification (C2B) Use developer.safaricom.co.ke for testing. ``` curl -X POST --header "Content-Type: application/json" --header "Authorization: Bearer XXXXXXXXXXXXXXXXXXXXXXXXXX" -d "{ \"ShortCode\": \"601402\", \"CommandID\": \"CustomerPayBillOnline\", \"Amount\": \"15\", \"Msisdn\": \"0014159523087\", \"BillRefNumber\": \"2\" }" "sandbox.safaricom.co.ke" ``` ## Plan (wip, to be moved to credentials …

Languages