Quick Web
Search…
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:
1
http://yourdomain/payment-response?reqid=????&clientRef=???
Copied!
You need to handle this HTTP GET request so you need to setup an endpoint for this. Examples are shown below:
Node.js
PHP
Java
.NET
1
const express = require('express');
2
const router = express.Router();
3
4
router.post('/', function(req, res, next) {
5
processResponse(req, res, next);
6
});
7
8
router.get('/', function(req, res, next) {
9
processResponse(req, res, next);
10
});
11
12
function processResponse(req, res, next) {
13
// 1. CONFIRM THIS IS AN EXPECTED REQUEST VIA CLIENT REF VERIFICATION
14
// 2. POST THE PAYMENT CONFIRMATION TO PAYCORP
15
// 3. FUTHER PAYMENT PROCESSING
16
}
17
18
module.exports = router;
19
Copied!
1
//Get req_id from the URL params
2
$csrfToken = $_REQUEST['reqid'];
3
4
//Get Client_ref from the URL params
5
$clientRef = $_REQUEST['clientRef'];
6
7
// 1. CONFIRM THIS IS AN EXPECTED REQUEST VIA CLIENT REF VERIFICATION
8
// 2. POST THE PAYMENT CONFIRMATION TO PAYCORP
9
// 3. FUTHER PAYMENT PROCESSING
10
Copied!
1
public class QuickWeb extends HttpServlet {
2
3
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
4
throws ServletException, IOException {
5
6
String reqId = request.getParameter("reqid");
7
String clientRef = request.getParameter("clientRef");
8
9
// 1. CONFIRM THIS IS AN EXPECTED REQUEST VIA CLIENT REF VERIFICATION
10
// 2. POST THE PAYMENT CONFIRMATION TO PAYCORP
11
// 3. FUTHER PAYMENT PROCESSING
12
}
13
14
@Override
15
protected void doGet(HttpServletRequest request, HttpServletResponse response)
16
throws ServletException, IOException {
17
processRequest(request, response);
18
}
19
20
}
21
Copied!
1
var csrfToken = Request.QueryString["reqid"];
2
var clientRef = Request.QueryString["clientRef"];
3
4
// 1. CONFIRM THIS IS AN EXPECTED REQUEST VIA CLIENT REF VERIFICATION
5
// 2. POST THE PAYMENT CONFIRMATION TO PAYCORP
6
// 3. FUTHER PAYMENT PROCESSING
Copied!
Last modified 2yr ago
Copy link