-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
57 lines (42 loc) · 1.34 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
const axios = require('axios');
async function mpesaPayment(customer,products,amount,callback_details) {
headers = {
"domain": process.env.CHPTER_CLIENT_DOMAIN,
"Authorization":"Token "+ process.env.CHPTER_TOKEN
};
data = {
"customer_details" : customer,
"products" : products,
"amount" : amount,
"callback_details" : callback_details
};
let res = await axios.post("https://chpter.co/api/payment/payment-initiate-callback/", data, { headers: headers});
return res.data;
}
async function cardPayment(customer,products,amount, card_details, callback_details) {
headers = {
"domain": process.env.CHPTER_CLIENT_DOMAIN,
"Authorization":"Token "+ process.env.CHPTER_TOKEN
};
data = {
"customer_details" : customer,
"products" : products,
"amount" : amount,
"card_details" : card_details,
"callback_details" : callback_details
};
let res = await axios.post("https://chpter.co/api/payment/payment-initiate-callback/", data, { headers: headers});
return res.data;
};
function mobilePayout() {
return "mobilePayout";
};
function domesticBanksPayout() {
return "domesticBanksPayout";
};
module.exports = {
mpesaPayment,
cardPayment,
mobilePayout,
domesticBanksPayout,
}