Java 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 Process

Download the Merchant Payment Notification Code Sample and add to your project

3. Implementing the service endpoints

/getIntegrationServices

This service is mandatory.
This service allows Paga to verify which integration service the merchant implementation supports in order to configure subsequent interaction with the merchant platform.

@ApiOperation(value = "Get Integration Services ", notes = "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.")
@PostMapping("/svc/v1/getIntegrationServices")
public @ResponseBody SupportedMerchantServiceResponse getMerchantSupportedServices(@RequestBody RequestServer requestServer) throws PaymentNotificationException {

        SupportedMerchantServiceResponse supportedMerchantServiceResponse = merchantPaymentNotificationService
                .getSupportedIntegationServices(requestServer);

        log.info("supported merchant service response {} ", supportedMerchantServiceResponse);

        return supportedMerchantServiceResponse;
    }

/getMerchantServices

This service provides the mechanism for Paga to request a list of named merchant services and associated service properties provided by the merchant.

@ApiOperation(value = "Get Merchant Services", notes = "This service provides the mechanism for Paga to request a list" +
            " of named merchant services and associated service properties provide by the merchant.")
@PostMapping("/svc/v1/getMerchantServices")
public @ResponseBody MerchantServiceResponse getMerchantService(@RequestBody RequestServer requestServer) throws PaymentNotificationException {
        MerchantServiceResponse merchantServiceResponse = merchantPaymentNotificationService.getMerchantService(requestServer);
        log.info("merchant service response {} ", merchantServiceResponse);
        return merchantServiceResponse;
 }

/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.

@ApiOperation(value = "Validate Customer", notes = "This service allows Paga to verify the existence of a customer in" +
            " good standing with the merchant using several customer properties.")
@PostMapping("/svc/v1/validateCustomer")
public @ResponseBody CustomerValidationResponse validateCustomer(@RequestBody CustomerValidationRequest customerValidationRequest) {

CustomerValidationResponse  customerValidationResponse = merchantPaymentNotificationService
                .validateCustomer(customerValidationRequest);

        System.out.println(customerValidationResponse);

        return customerValidationResponse;
 }

/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.

@ApiOperation(value = "Submit Transaction or Payment Execution", notes = "This service provides the mechanism for Paga " +
            "to submit a payment notification to the merchant systems and receive confirmation of its approval")
@PostMapping("/svc/v1/submitTransaction")
public @ResponseBody SubmitTransactionResponse submitTransaction(@RequestBody SubmitTransactionRequest submitTransactionRequest)  {

SubmitTransactionResponse submitTransactionResponse =  merchantPaymentNotificationService.submitTransaction(submitTransactionRequest);

        log.info(" submit transaction response{} ",submitTransactionResponse);
        return submitTransactionResponse;
}