PHP Sample Code
The Merchant Payment Notification API enables merchants to integrate with the Paga platform. This enables Paga to process automated real-time payment transactions with the Merchant's systems using secure RestFul Web Services.
1. Create Paga Business Account
You need to create a Paga business account
2. Installation
Download the merchantPaymentNotification.php to your project
Download the .htaccess
3.Implementing the service endpoints
/getIntegrationServices
This service is mandatory.
This service allows Paga to verify which of the integration services the merchant implementation supports in order to configure subsequent interaction with the merchant platform.
function getIntegrationServices($body){
$response = null;
if($body["isTest"]){
//response from QA test db
$response = array("services" => array("VALIDATE_CUSTOMER", "MERCHANT_SERVICES", "SUBMIT_PAYMENT"));
}else {
//response from live db
}
if($response != null)
$response = json_encode($response);
return $response;
}
/validateCustomer
This service is optional.
This service allows Paga to verify the existence of a customer in good standing with the merchant using several customer properties.
function validateCustomer($body){
$response = null;
if($body["isTest"]){
//response from QA test db
$response = array("status" => "SUCCESS", "message"=>"Test Message", "isValid"=>true, "firstName"=>"firstName",
"lastName"=>"lastName", "lastPaymentDate"=>"2020-01-01", "accountStatus"=>"valid",
"paymentDueDate"=>"2022-01-01", "isDisplayed"=>true);
}else {
//response from live db
}
if($response != null)
$response = json_encode($response);
return $response;
}
/getMerchantServices
This service provides the mechanism for Paga to request a list of named merchant services and associated service properties provided by the merchant.
function getMerchantServices($body){
$response = null;
if($body["isTest"]){
//response from QA db
$response = array("merchantService" =>
array("name"=>"Service name", "price"=>1200.23, "shortCode"=>"serviceCode", "productCode"=>"prodCode",
"isPublic"=>true));
}else {
//response from live db
}
if($response != null)
$response = json_encode($response);
return $response;
}
/submitTransaction
This service is mandatory.
This service provides the mechanism for Paga to submit a payment notification to the merchant systems and receive confirmation of its approval.
function submitTransaction($body){
$response = null;
if($body["isTest"]){
//response from QA test db
$response = array("status"=>"SUCCESS", "uniqueTransactionId"=>"trxn_Id", "customerReference"=>"1234567", "merchantStatus"=>"SUCCESS", "message"=>"successful payment from merchant", "confirmationCode"=>"Code12345");
}else {
//response from live db
}
if($response != null)
$response = json_encode($response);
return $response;
}
Updated over 4 years ago