From 3fcdb848738153813eb57daa188d467f60f76727 Mon Sep 17 00:00:00 2001 From: andrew-paystack Date: Fri, 7 Feb 2025 16:29:15 +0300 Subject: [PATCH] update dist folder --- .../payment-methods/mobile-mpesa-till.js | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 dist/doc/payments/payment-methods/mobile-mpesa-till.js diff --git a/dist/doc/payments/payment-methods/mobile-mpesa-till.js b/dist/doc/payments/payment-methods/mobile-mpesa-till.js new file mode 100644 index 0000000..26479c0 --- /dev/null +++ b/dist/doc/payments/payment-methods/mobile-mpesa-till.js @@ -0,0 +1,92 @@ +const sh = `curl https://api.paystack.co/charge +-H "Authorization: Bearer YOUR_SECRET_KEY" +-H "Content-Type: application/json" +-d '{ "amount": 100, + "email": "customer@email.com", + "currency": "KES", + "mobile_money": { + "account" : "1234567", + "provider" : "mptill" + } + }' +-X POST` + +const js = `const https = require('https') + +const params = JSON.stringify({ + "amount": 100, + "email": "customer@email.com", + "currency": "KES", + "mobile_money": { + "account" : "1234567", + "provider" : "mptill" + } +}) + +const options = { + hostname: 'api.paystack.co', + port: 443, + path: '/charge', + method: 'POST', + headers: { + Authorization: 'Bearer SECRET_KEY', + 'Content-Type': 'application/json' + } +} + +const req = https.request(options, res => { + let data = '' + + res.on('data', (chunk) => { + data += chunk + }); + + res.on('end', () => { + console.log(JSON.parse(data)) + }) +}).on('error', error => { + console.error(error) +}) + +req.write(params) +req.end()` + +const php = ` "https://api.paystack.co/charge", + CURLOPT_RETURNTRANSFER => true, + CURLOPT_ENCODING => "", + CURLOPT_MAXREDIRS => 10, + CURLOPT_TIMEOUT => 30, + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, + CURLOPT_CUSTOMREQUEST => "POST", + CURLOPT_POSTFIELDS => [ + "amount" => 100, + "email" => "customer@email.com", + "currency" => "KES", + "mobile_money" => [ + "account" => "1234567", + "provider" => "mptill" + ] + ], + CURLOPT_HTTPHEADER => array( + "Authorization: Bearer SECRET_KEY", + "Content-Type: application/json" + ), +)); + +$response = curl_exec($curl); +$err = curl_error($curl); + +curl_close($curl); + +if ($err) { + echo "cURL Error #:" . $err; +} else { + echo $response; +}` + +export {sh, js, php} \ No newline at end of file