Create a gist now

Instantly share code, notes, and snippets.

Description of how to retrieve the WPF Url for Peach Payments using Node.js
var request = require('request');
exports.getPaymentUrl = function(data, callback) {
//You will need to supply values for these first four values
var params = {
'SECURITY.SENDER': 'xxxx',
'USER.LOGIN': 'xxxx',
'USER.PWD': 'xxxx',
'TRANSACTION.CHANNEL': 'xxxxx',
'TRANSACTION.MODE': "INTEGRATOR_TEST",
'REQUEST.VERSION': "1.0",
'IDENTIFICATION.TRANSACTIONID': "YourTransactionIdHere",
'FRONTEND.ENABLED': "true",
'FRONTEND.POPUP': "false",
'FRONTEND.MODE': "DEFAULT",
'FRONTEND.LANGUAGE': "en",
'PAYMENT.CODE': "CC.DB",
'FRONTEND.RESPONSE_URL': "http://www.merchant.com/response-page.php",
'NAME.GIVEN': "Ian",
'NAME.FAMILY': "Petzer",
'ADDRESS.STREET': "8 Denheath",
'ADDRESS.ZIP': "8001",
'ADDRESS.CITY': "Cape Town",
'ADDRESS.COUNTRY': "South Africa",
'CONTACT.EMAIL': "ianpetzer@gmail.com",
'PRESENTATION.AMOUNT': "99.00",
'PRESENTATION.CURRENCY': "ZAR"
}
request.post('https://test.ctpe.net/frontend/payment.prc', {form: params}, function (err, res, body) {
if (err) callback(err);
var payload = {};
body.split("&").forEach(function (responseParts) {
var keyValues = responseParts.split('=');
payload[keyValues[0]] = decodeURIComponent(keyValues[1]);
});
callback(null, payload['FRONTEND.REDIRECT_URL']);
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment