Quick Web
  • QuickWeb Technical Guide
  • Getting connected
    • 1. Include Paycorp Payments JS
    • 2. Initialise the Payment
    • 3. Setup an HTTP GET endpoint
    • 4. Confirm the payment
    • 5. Process the Payment
  • Support
  • Sample Code
Powered by GitBook
On this page
  1. Getting connected

3. Setup an HTTP GET endpoint

Previous2. Initialise the PaymentNext4. Confirm the payment

Last updated 6 years ago

Once your HTML page containing the 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 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;
//Get req_id from the URL params
$csrfToken = $_REQUEST['reqid'];

//Get Client_ref from the URL params
$clientRef = $_REQUEST['clientRef'];

// 1. CONFIRM THIS IS AN EXPECTED REQUEST VIA CLIENT REF VERIFICATION
// 2. POST THE PAYMENT CONFIRMATION TO PAYCORP
// 3. FUTHER PAYMENT PROCESSING
public class QuickWeb extends HttpServlet {

    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

        String reqId = request.getParameter("reqid");
        String clientRef = request.getParameter("clientRef");
        
        // 1. CONFIRM THIS IS AN EXPECTED REQUEST VIA CLIENT REF VERIFICATION
        // 2. POST THE PAYMENT CONFIRMATION TO PAYCORP
        // 3. FUTHER PAYMENT PROCESSING
    }

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        processRequest(request, response);
    }
    
}
var csrfToken = Request.QueryString["reqid"];
var clientRef = Request.QueryString["clientRef"];

 // 1. CONFIRM THIS IS AN EXPECTED REQUEST VIA CLIENT REF VERIFICATION
 // 2. POST THE PAYMENT CONFIRMATION TO PAYCORP
 // 3. FUTHER PAYMENT PROCESSING
initialise-the-payment
initialise-the-payment