3. Setup an HTTP GET endpoint

Once your HTML page containing the initialise-the-payment script is rendered in the users browser a payment will be initialised and the user will be presented with the payment form. The user will provide the required card data and the form will be submitted to Paycorp's servers.

Payment එක ආරම්භ කිරිමේ කොටසේ ආකාරයට <script> tag එක HTML පිටුවට අඩංගු කරගැනීමෙන් පසු පරිශීලකයකයාගේ Web Browser එකේ Payment එක ආරම්භ වී Payment ආකෘති පත්‍රය දිස්වේ.පරිශීලකයා විසින් ක්‍රෙඩිට් කාඩ් පතෙහි තොරතුරු සැපයූ පසු එම තොරතුරු Paycorp’s Servers වෙත එවනු ලැබේ. එම දත්ත Paycorp එකට ලැබීමෙන් පසු Paycorp එක විසින් පරිශීලකයාගේ Web Browser එක හරහා යෙදුම අයිති පුද්ගලයාගේ Payment එක ආරම්භ කිරිමේ කොටසේ සදහන් කල Return Url එක වෙත යවනු ලැබේ.

After receiving the payment data Paycorp will redirect the users browser to the URL specified in the initialise-the-payment step, for example:

http://yourdomain/payment-response?reqid=????&clientRef=???

You need to handle this HTTP GET request so you need to setup an endpoint for this. Examples are shown below:

const express = require('express');
const router = express.Router();

router.post('/', function(req, res, next) {
  processResponse(req, res, next);
});

router.get('/', function(req, res, next) {
  processResponse(req, res, next);
});

function processResponse(req, res, next) {
  // 1. CONFIRM THIS IS AN EXPECTED REQUEST VIA CLIENT REF VERIFICATION
  // 2. POST THE PAYMENT CONFIRMATION TO PAYCORP
  // 3. FUTHER PAYMENT PROCESSING
}

module.exports = router;

Last updated