payme-sdk
Version:
A Node.js SDK to integrate with PAYME API
98 lines (97 loc) • 3.19 kB
TypeScript
export type Payment = {
reference: string;
account_id: number;
amount: number;
fees: number;
tva: number;
description: string;
status: string;
created_at: string;
updated_at: string;
};
export type PaymentItem = {
reference: string;
payment_id: number;
customer_id: number;
amount: number;
fees: number;
phone: string;
payment_method: string;
payment_proof: string;
status: string;
created_at: string;
updated_at: string;
};
export type Fees = {
operation_type: string;
corridor_tag: string;
operand: string;
min_amount: number;
max_amount: number;
value: number;
};
export interface PaymentParam {
reference: string;
amount: number;
fees: number;
tva: number;
description: string;
}
export interface PaymentItemParam {
reference?: string;
currency?: string;
customer_name?: string;
customer_email?: string;
customer_country?: string;
amount: number;
fees: number;
transaction_id: number;
phone: string;
}
declare class PayMeSDK {
private email;
private password;
private apiKey;
private merchant;
private token;
private account;
private externalDataService;
constructor(email: string, password: string, apiKey: string);
/**
* This function check if a merchant with a specific key exists
* @param key apiKey of the merchant
*/
init(): Promise<void>;
/**
* This function calculate the applicable fees of a payment
* @param amount amount of the payment
* @param country country where the payment will be done
*/
getFees(amount: number, country: string): Promise<Pick<any, "operation_type" | "corridor_tag" | "operand" | "min_amount" | "max_amount" | "value">>;
/**
* This function register a payment / simple / partial / grouped
* @param param payment parameters
*/
postPayment(param: PaymentParam): Promise<any>;
/**
* This function check the status of a payment
* @param reference uniq reference of the transaction
*/
getPaymentStatus(reference: string): Promise<Pick<any, "reference" | "account_id" | "amount" | "fees" | "tva" | "description" | "status" | "created_at" | "updated_at">>;
/**
* This function init the payment of a customer
* @param param parameters of the item payment
*/
postPaymentItem(param: PaymentItemParam): Promise<any>;
/**
* This function check the status of a payment item
* @param reference uniq reference of the payment item
*/
getPaymentItemStatus(reference: string): Promise<Pick<any, "reference" | "amount" | "fees" | "status" | "created_at" | "updated_at" | "payment_id" | "customer_id" | "phone" | "payment_method" | "payment_proof">>;
/**
* This function return the payment and his associated payment items
* @param reference uniq reference of the payment
*/
getPaymentWithItems(reference: string): Promise<Pick<any, "reference" | "account_id" | "amount" | "fees" | "tva" | "description" | "status" | "created_at" | "updated_at" | "payment_type" | "paymentItems">>;
}
export default PayMeSDK;