Card Payment Gateway (Curl-Direct)
Registered merchants can use the parameters by using POST method [PAYCLY Merchant] to make sure the values won’t be changed.
Method | POST |
Function | Accept credit card payment online from the customers |
Remark | 11 mandatory parameters, the others are all optional |
Important - Website API Token and Website Id is required for all the web/curling based integration, if you are using any shopping cart which we do support in plugins or you may have your own shopping cart which we do not support. In both the cases, you need to pass one Website API Token and Website Id that can be used for all your products. Our API has the capability to receive any price from the Website API Token and Website Id. You may pass the dynamic 'price' parameter (i.e. price) to us by using the same Website Id.
Parameter | Description |
---|---|
api_token (required) | Website API Token is a string value. |
website_id (required) | Website Id is very important parameter. |
cardsend (required) | cardsend, a string for default (fixed) value curl. |
client_ip (required) | Client IP a php code dynamic get IP value ($_SERVER['HTTP_X_FORWARDED_FOR']? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']). |
action (required) | action, a string for default (fixed) value product. |
source (required) | source, a string for default (fixed) value Curl-Direct-Card-Payment. |
source_url (required) | source_url, Product or Service url of source_url as per your domain - a string for default (fixed) value isset($_SERVER["HTTPS"]) ? 'https://':'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']. |
price (required) | Order Amount, currency format in decimal(10,2) |
curr (required) | Currency name of Order Amount, should be string |
product_name (required) | Product Name |
fullname (required) | Customer full name |
email (required) | Customer billing email |
bill_street_1 (required) | Customer's shipping street |
bill_street_2 (required) | Customer's shipping street 2 |
bill_city (required) | Customer's shipping city |
bill_state (required) | Customer's shipping state |
bill_country (required) | Customer's shipping country |
bill_zip (required) | Customer's shipping zip code |
bill_phone (required) | Customer billing phone |
id_order (optional) | Merchant’s order ID that will be returned back in a callback. |
notify_url (optional) | Synchronous notification URL, you can find it in the response data. |
success_url (optional) | Redirect url of success as per your domain |
error_url (optional) | Redirect url of error as per your domain |
Encrypted Payment Gateway (curl-direct)
You need to add one additional parameter for Encrypted Payment Gateway
Website Secret Key (required) | Website Secret Key is a string value. |
Example of Card Payment Gateway (Curl-Direct):
$gateway_url
=
***************
;
$protocol
=
isset($_SERVER["HTTPS"])?'https://':'http://'
;
$referer
=
$protocol.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']
;
$curlPost
=
array()
;
//Replace of 2 very important parameters * your Website API Token and Website ID
$curlPost ["api_token"]
=
"****************"
; //Website API Token
$curlPost ["website_id"]
=
"****"
; //Website Id
//default (fixed) value * default
$curlPost["cardsend"]
=
"curl"
;
$curlPost["client_ip"]
=
"($_SERVER['HTTP_X_FORWARDED_FOR']?$_SERVER['HTTP_X_FORWARDED_FOR']:$_SERVER['REMOTE_ADDR'])"
;
$curlPost["action"]
=
"product"
;
$curlPost["source"]
=
"Curl-Direct-Card-Payment"
;
$curlPost["source_url"]
=
"$referer"
;
//product price,curr and product name * by cart total amount
$curlPost["price"]
=
"10.00"
;
$curlPost["curr"]
=
"USD"
;
$curlPost["product_name"]
=
"Testing Product"
;
//billing details of .* customer
$curlPost["product_name"]
=
"Testing Product"
;
$curlPost["fullname"]
=
"Test Full Name"
;
$curlPost["email"]
=
"test.0110@test.com"
;
$curlPost["bill_street_1"]
=
"25A Alpha"
;
$curlPost["bill_street_2"]
=
"tagore lane"
;
$curlPost["bill_street_2"]
=
"tagore lane"
;
$curlPost["bill_city"]
=
"Jurong"
;
$curlPost["bill_state"]
=
"Singapore"
;
$curlPost["bill_country"]
=
"Singapore"
;
$curlPost["bill_zip"]
=
"787602"
;
$curlPost["bill_phone"]
=
"+65 62200944"
;
$curlPost["id_order"]
=
"20170131"
;
$curlPost["notify_url"]
=
"https://yourdomain.com/notify.php"
;
$curlPost["success_url"]
=
"https://yourdomain.com/success.php"
;
$curlPost["error_url"]
=
"https://yourdomain.com/failed.php"
;
//card details of .* customer
$curlPost["ccno"]
=
"4242424242424242"
;
$curlPost["ccvv"]
=
"123"
;
$curlPost["month"]
=
"01"
;
$curlPost["year"]
=
"30"
;
$curlPost["notes"]
=
"Remark for transaction"
;
$curl_cookie
=
""
;
$curl
=
curl_init()
;
curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0)
;
curl_setopt($curl, CURLOPT_URL, $gateway_url)
;
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false)
;
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0)
;
curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT'])
;
curl_setopt($curl, CURLOPT_REFERER, $referer)
;
curl_setopt($curl, CURLOPT_POST, 1)
;
curl_setopt($curl, CURLOPT_POSTFIELDS, $curlPost)
;
curl_setopt($curl, CURLOPT_HEADER, 0)
;
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1)
;
$response = curl_exec($curl)
;
curl_close($curl)
;
$results
=
json_decode($response,true)
;
$status
=
strtolower($results["status"])
;
$sub_query
=
http_build_query($results)
;
if(isset($results["pay_url"])
&&
$results["pay_url"]){
$redirecturl = $results["pay_url"] ; header("Location:$redirecturl") ; exit ; }elseif($status=="completed" || $status=="success" || $status=="test" || $status=="test transaction"){ $redirecturl = $curlPost["success_url"] ; if(strpos($redirecturl,'?')!==false){ $redirecturl = $redirecturl."&".$sub_query ; }else{ $redirecturl = $redirecturl."?".$sub_query; ; } header("Location:$redirecturl") ; exit ; }elseif($status=="pending"){ $redirecturl = $referer; ; if(strpos($redirecturl,'?')!==false){ $redirecturl = $redirecturl."&".$sub_query; ; }else{ $redirecturl = $redirecturl."?".$sub_query ; } header("Location:$redirecturl") ; exit ; }else{ $redirecturl = $curlPost["error_url"] ; if(strpos($redirecturl,'?')!==false){ $redirecturl = $redirecturl."&".$sub_query; ; }else{ $redirecturl = $redirecturl."?".$sub_query ; } header("Location:$redirecturl") ; exit ; } |
Test Card Number
Credit Card Type | Credit Card Number | Expiry Month | Expiry Year | CVV |
---|---|---|---|---|
MasterCard | 5555555555554444 | 01 | 30 | 123 |
Visa | 4242424242424242 | 01 | 30 | 123 |
After posting the data you will get below response:
"transaction_id"
:
"20221009122934"
,
"status_nm"
:
"1"
,
"status"
:
"Success"
,
"price"
:
"30.00"
,
"curr"
:
"USD"
,
"id_order"
:
"20170131"
,
"cardtype"
:
"visa"
,
"ccno"
:
"XXXXXXXXXXXX4242"
,
"reason"
:
"success"
,
"fullname"
:
"Test Full Name"
,
"email"
:
"test.3545@test.com"
,
"address"
:
"25A Alpha,tagore lane"
,
"city"
:
"Jurong"
,
"state"
:
"Singapore"
,
"country"
:
"Singapore"
,
"phone"
:
"+65 62200944"
,
"product_name"
:
"Testing Product"
,
"amt"
:
"30.00"
,
"memail"
:
"billing@PAYCLY"
,
"company"
:
"PAYCLY"
,
"bussinessurl"
:
"https://example.com"
,
"contact_us_url"
:
"https://example.com/contact-us"
,
"customer_service_no"
:
"912233445566"
,
"tdate"
:
"2017-10-11 10:30:09"
,
"callbacks"
:
"OK"
,
"info"
:
"{"
"fullname"
:
"Test Full Name"
,
"email"
:
"test.3545@test.com"
,
"etc..."
:
"....."
}
}
//Echo for your data of response:
echo
$results['
'status_nm'
];
echo
$results['
'status'
];
echo
$results['
'amount'
];
echo
$results['
'transaction_id'
];
echo
$results['
'descriptor'
];
echo
$results['
'tdate'
];
echo
$results['
'curr'
];
echo
$results['
'reason'
];
echo
$results['
'id_order'
];
|