daraja
Version:
A NodeJS library to simplify integration with Safaricom's Daraja M-Pesa API
127 lines (126 loc) • 3.1 kB
TypeScript
import * as moment from 'moment';
import { Environment } from './types';
export declare const generateToken: (
environment: Environment,
consumerKey: string,
consumerSecret: string,
accessToken: string,
expiryDate: moment.Moment
) => Promise<{
accessToken: any;
expiryDate: moment.Moment;
}>;
export declare const mpesaExpressRequest: (
environment: Environment,
accessToken: string,
shortcode: number,
passkey: string,
transactionType: 'CustomerPayBillOnline' | 'CustomerBuyGoodsOnline',
amount: number,
sender: number,
recipient: number,
callbackUrl: string,
accountReference: string,
transactionDescription: string
) => Promise<{
merchantRequestId: any;
checkoutRequestId: any;
}>;
export declare const mpesaExpressQuery: (
environment: Environment,
accessToken: string,
shortcode: number,
passkey: string,
checkoutRequestId: string
) => Promise<{
resultCode: any;
resultDescription: any;
}>;
export declare const c2bRegisterUrl: (
environment: Environment,
accessToken: string,
shortcode: number,
validationUrl: string,
confirmationUrl: string,
responseType: 'Canceled' | 'Completed'
) => Promise<{
responseDescription: any;
}>;
export declare const c2bSimulateTransaction: (
environment: Environment,
accessToken: string,
shortcode: number,
sender: number,
amount: number,
billReference: string
) => Promise<{
conversationId: any;
originatorConversationId: any;
responseDescription: any;
}>;
export declare const b2cPaymentRequest: (
environment: Environment,
accessToken: string,
shortcode: number,
recipient: number,
amount: number,
commandId: 'SalaryPayment' | 'BusinessPayment' | 'PromotionPayment',
initiatorName: string,
initiatorPassword: string,
remarks: string,
occassion: string,
timeoutUrl: string,
resultUrl: string
) => Promise<{
conversationId: any;
originatorConversationId: any;
responseDescription: any;
}>;
export declare const accountBalanceRequest: (
environment: Environment,
accessToken: string,
shortcode: number,
identifierType: 2 | 4 | 1,
initiatorName: string,
initiatorPassword: string,
remarks: string,
timeoutUrl: string,
resultUrl: string
) => Promise<{
conversationId: any;
originatorConversationId: any;
responseDescription: any;
}>;
export declare const transactionStatusRequest: (
environment: Environment,
accessToken: string,
shortcode: number,
identifierType: 2 | 4 | 1,
initiatorName: string,
initiatorPassword: string,
transactionId: string,
remarks: string,
occassion: string,
timeoutUrl: string,
resultUrl: string
) => Promise<{
conversationId: any;
originatorConversationId: any;
responseDescription: any;
}>;
export declare const reversalRequest: (
environment: Environment,
accessToken: string,
shortcode: number,
initiatorName: string,
initiatorPassword: string,
transactionId: string,
remarks: string,
occassion: string,
timeoutUrl: string,
resultUrl: string
) => Promise<{
conversationId: any;
originatorConversationId: any;
responseDescription: any;
}>;