var Payment = var clientId = ""; // Get your Client ID from https://developer.interswitchng.comvar secret = ""; // Get your Client Secret from https://developer.interswitchng.comvar ENV = "SANDBOX"; // or PRODUCTIONvar payment = clientId secret ENV;var pan = "6280511000000095"; // Payment Cardvar expDate = "5004"; // Payment Card Expiry Date. Format YYMMvar cvv = "111"; // Payment Card CVVvar pin = "1111"; // // Payment Card PINvar amt = "35000";var currency = paymentNAIRA;var custId = "customer@myshop.com"; var { console; console;} // handle ValidateCard Responsevar { var httpRespCode = responsestatusCode console; console; var json = JSON; ifhttpRespCode == '202' && jsonresponseCode == 'T0' // Do OTP Authorization var otp = "123456"; // This will be sent to your (OTP) registered mobile phone number. var tranId = jsontransactionRef; payment; else ifhttpRespCode == '202' && jsonresponseCode == 'M0' console; } // Validate Cardvar validateReqRef = "ISW-SDK-VALIDATE-31";payment; // handle Payment Responsevar { var httpRespCode = responsestatusCode console; console; var json = JSON; ifhttpRespCode == '202' && jsonresponseCode == 'T0' // Do OTP Authorization var otp = "123456"; // This will be sent to your (OTP) registered mobile phone number. var tranId = jsonpaymentId; payment; else ifhttpRespCode == '202' && jsonresponseCode == 'M0' console; else // Get Payment Status payment; } // Authorize Paymentvar paymentReqRef = "ISW-SDK-PAYMENT-30";payment;
Installation
$ npm install paymentsdk
Features
See sample code here: https://github.com/techquest/interswitch_javascript/blob/master/server_sdks/payment.js
- Sends request to Payment API
- Packages Interswitch Sensitive Data (Card, PIN, CVV, Exp Date)
- Validates Payment Card - validateCard()
- Authorizes (Debit) Payment Card - authorize()
- Verify Payment with OTP before authorization (debit) - verifyOTP()
- Verify Card Validation with OTP - verifyOTP()
- Gets Payment Status - getStatus()