Checkout
Search…
1. Get Payment URL
Production
Sandbox
1
https://checkoutapi.oneglobal.com/MasterV1/
Copied!
1
https://checkoutstage.oneglobal.com/MasterV1/
Copied!

API Endpoints

Production Endpoint
Sandbox Endpoint
1
https://checkoutapi.oneglobal.com/MasterV1/api/GenToken/Validate
Copied!
1
https://checkoutstage.oneglobal.com/MasterV1/api/GenToken/Validate
Copied!

Sample Request & Response

Use the below parameters and hashing function for order creation. The request should contain the following inputs to make sure inputs should be encrypted using our hashing function show in the following example to prevent exposure. For parameters description please refer here
Sample Request
Sample Response
1
"ValidatePaymentRequest" : {
2
"merchantCode": "xxxxx"
3
"authKey": "xxxxxxxxx",
4
"currency": "KWD",
5
"pc": "KWKFHMPGSCCKWD",
6
"tunnel": "",
7
"amount": 1 ,
8
"doConvert": "N",
9
"sourceCurrency":"conditional",
10
"description": "optional",
11
"referenceID": "(15 digit random number)",
12
"timeStamp": "yyyy/MM/dd HH:mm:ss tt",
13
"language": "en",
14
"callbackURL": "Your website URL",
15
"hash": "ComputedHash",
16
"userReference": 0,
17
"billingDetails":
18
{
19
"fName": "First Name",
20
"lName": "last Name",
21
"mobile": "mobile",
22
"email": "email",
23
"city": "city",
24
"pincode": "pincode",
25
"state": "state",
26
"address1": "address1",
27
"address2": "address2"
28
}
29
}
Copied!
1
{
2
"errorCode": 0,
3
"errorMessgae": "string",
4
"result":
5
{
6
"redirectURL": "string",
7
"tokenID": "string",
8
"orderAmount": 0,
9
"paidAmount": 0,
10
"serviceAmount": 0,
11
"commissionAmount": 0,
12
"originalAmount": "string"
13
}
14
}
Copied!

Sample Code to post data

C#
VB.Net
PHP
TypeScript
1
public async Task> ValidatePayment(ValidatePaymentRequest obj)
2
{
3
Output dto = new Output();
4
var url = {Provided End Point};
5
var client = new HttpClient();
6
client.BaseAddress = new Uri(url);
7
try
8
{
9
obj.hash = ComputeHash(obj);
10
var resultser = JsonConvert.SerializeObject(obj);
11
client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
12
client.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/json; charset=utf-8");
13
var response = client.PostAsJsonAsync(url, obj).Result;
14
if (response.IsSuccessStatusCode)
15
{
16
var ss = response.Content.ReadAsStringAsync();
17
var result = JsonConvert.DeserializeObject>(ss.Result);
18
dto = result;
19
}
20
else
21
{
22
var ss = response.Content.ReadAsStringAsync();
23
var resps = ss.Result.ToString();
24
}
25
}
26
catch (HttpRequestException ex)
27
{
28
}
29
return dto;
30
}
Copied!
1
Class SurroundingClass
2
Public Task As async
3
4
Private Sub New(ByVal obj As ValidatePaymentRequest)
5
Dim dto As Output = New Output()
6
Dim url = {Provided End Point};
7
Dim client = New HttpClient()
8
client.BaseAddress = New Uri(url)
9
10
Try
11
obj.hash = ComputeHash(obj)
12
Dim resultser = JsonConvert.SerializeObject(obj)
13
client.DefaultRequestHeaders.Accept.Add(New System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"))
14
client.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/json; charset=utf-8")
15
Dim response = client.PostAsJsonAsync(url, obj).Result
16
17
If response.IsSuccessStatusCode Then
18
Dim ss = response.Content.ReadAsStringAsync()
19
Dim result = JsonConvert.DeserializeObject > (ss.Result)
20
dto = result
21
Else
22
Dim ss = response.Content.ReadAsStringAsync()
23
Dim resps = ss.Result
24
Dim resultse = JsonConvert.SerializeObject(resps.ToString())
25
End If
26
27
Catch ex As HttpRequestException
28
End Try
29
30
Return dto
31
End Sub
32
End Class
Copied!
1
<?php
2
// store order id
3
$order = 12 xxxx;
4
// referenceID must be 15 digit unique number
5
$referenceID = 123456412250000;
6
$timestamp = date( "y/m/d H:m:s t" );
7
// referenceID must be 10 digit unique number
8
$userReference = 1234564122;
9
$amount = 20.50;
10
$authKey = 'Your Authorization Key';
11
$merchantID = 'Your Merchent Key';
12
$currency = 'KWD';
13
// it should be ALL for all payment methods or specific payment method code i.e KNET
14
$paymentMethodCode = 'KNET';
15
// it will be null if store currency is same as your merchant currency.
16
$sourceCurrency = "";
17
// It will be Y if source currency and merchant currency is different
18
$doConvert = 'N';
19
// Concat all data string
20
$datatocomputeHash = ( float )$amount . $authKey . $currency . $merchantID . $paymentMethodCode . ( int )$referenceID . $sourceCurrency . $timestamp . $tunnel . ( int )$userReference;
21
// convert the concated string in to hash and convert all string in upper character.
22
$hash = strtoupper( hash_hmac( "sha256", $datatocomputeHash, $secretkey ) );
23
$data = array(
24
'merchantCode' => $merchantID,
25
'authKey' => $authKey,
26
'currency' => $paymentMethodCurrency,
27
'pc' => $paymentMethodCode,
28
'tunnel' => $tunnel,
29
'amount' => ( float )$amount,
30
'doConvert' => $doConvert,
31
'sourceCurrency' => $sourceCurrency,
32
'description' => $description,
33
'referenceID' => ( int )$ref,
34
'timeStamp' => $timestamp,
35
'language' => 'en',
36
'callbackURL' => 'https://www.example.com',
37
'hash' => $hash,
38
'userReference' => ( int )$userReference,
39
'billingDetails' => array(
40
'fName' => 'First Name',
41
'lName' => 'Last Name',
42
'mobile' => '0000000000',
43
'email' => '[email protected]',
44
'city' => 'city',
45
'pincode' => '000000',
46
'state' => 'State',
47
'address1' => 'Address 1',
48
'address2' => 'Address 2'
49
),
50
);
51
$request = json_encode( $data, true );
52
if ( !$endpoint ) {
53
$curl = curl_init( 'https://ogcheckoutstage.oneglobal.com/OgPay/V1/api/GenToken/Validate' );
54
} else {
55
$curl = curl_init( $endpoint );
56
}
57
curl_setopt( $curl, CURLOPT_POST, true );
58
curl_setopt( $curl, CURLOPT_POSTFIELDS, $request );
59
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true );
60
curl_setopt( $curl, CURLOPT_HTTPHEADER, array( 'Content-Type:application/json' ) );
61
$ch = curl_exec( $curl );
62
curl_close( $curl );
63
$response = json_decode( $ch, true );
64
?>
Copied!
1
pagecode:` public async Task> ValidatePayment(ValidatePaymentRequest obj)
2
{
3
Output dto = new Output();
4
var url = {Provided End Point};
5
var client = new HttpClient();
6
client.BaseAddress = new Uri(url);
7
try
8
{
9
obj.hash = ComputeHash(obj);
10
var resultser = JsonConvert.SerializeObject(obj);
11
client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
12
client.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/json; charset=utf-8");
13
var response = client.PostAsJsonAsync(url, obj).Result;
14
if (response.IsSuccessStatusCode)
15
{
16
var ss = response.Content.ReadAsStringAsync();
17
var result = JsonConvert.DeserializeObject>(ss.Result);
18
dto = result;
19
}
20
else
21
{
22
var ss = response.Content.ReadAsStringAsync();
23
var resps = ss.Result;
24
var resultse = JsonConvert.SerializeObject(resps.ToString());
25
26
}
27
}
28
catch (HttpRequestException ex)
29
{
30
31
}
32
33
return dto;
34
35
}`;
Copied!

Last modified 1mo ago