View Categories

Apple Pay

3 min read

Apple Pay, a cutting-edge contact-less payment platform redefining transactions. Experience the future as you seamlessly use your iPhone or Apple Watch to make payments from multiple bank accounts, eliminating the need for physical cards or cash. 

With advanced authentication methods like Touch ID or Face ID, transactions are not only secure but also incredibly efficient. Revolutionize your payment experience with Apple Pay – where technology meets convenience.

Configuration

Paybiz seamlessly incorporates Apple Pay functionality through a systematic process. The Paybiz system adeptly identifies the platform of the consumer device, with a keen focus on iOS operating systems. Upon detecting an iOS-based device, Paybiz efficiently retrieves the Apple Wallet ID, enabling the activation of the ‘Pay with Apple Pay’ button.

This technical precision ensures a smooth and secure payment experience, aligning seamlessly with the Apple Pay ecosystem within the Paybiz platform.

How it works



Prepare the Checkout

First, perform a server-to-server POST request to prepare the checkout with the required data, including the order type, amount and currency. The response to a successful request is a JSON string with an id, which is required in the second step to create the payment form.

private String request() throws IOException {
	URL url = new URL(“https: //staging.logibiztech.com:8777/transaction/request-payment-url");

	HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
	conn.setRequestMethod("POST");
        conn.setRequestProperty("Authorization",
    "Bearer OGE4Mjk0MTc0YjdlY2IyODAxNGI5Njk5MjIwMDE1Y2N8c3k2S0pzVDg=");
	conn.setDoInput(true);
	conn.setDoOutput(true);
	String data = "{"actionCode":"1","amount":"130",
"browserColorDepth": "24",
    "browserJavaEnabled": "true",
    "browserJavaScriptEnabled": "true",
    "browserLanguage": "en-PK",
    "browserScreenHeight": "714",
    "browserScreenWidth": "1536",
    "browserTimeZone": "-300",
    "currency": "840",
    "errorUrl": "https://www.logibiztech.com/details",
    "javaScriptEnabled": true,
    "langId": "EN",
    "password": "******",
    "successUrl": "https://www.logibiztech.com/details",
    "trackId": "00008",
    "tranPortalId": "t2",
    "udf": [
        ""
    ]
}";

	DataOutputStream wr = new DataOutputStream(conn.getOutputStream());
	wr.writeBytes(data);
	wr.flush();
	wr.close();
	int responseCode = conn.getResponseCode();
	InputStream is;

	if (responseCode >= 400) is = conn.getErrorStream();
	else is = conn.getInputStream();
	return IOUtils.toString(is);
}

{
    "actionCode": "1",
    "amount": "130",
    "browserColorDepth": "24",
    "browserJavaEnabled": "true",
    "browserJavaScriptEnabled": "true",
    "browserLanguage": "en-PK",
    "browserScreenHeight": "714",
    "browserScreenWidth": "1536",
    "browserTimeZone": "-300",
    "currency": "840",
    "errorUrl": "https://www.logibiztech.com/details",
    "javaScriptEnabled": true,
    "langId": "EN",
    "password": "******",
    "successUrl": "https://www.logibiztech.com/details",
    "trackId": "00008",
    "tranPortalId": "t2",
    "udf": [""]
}


Response

Success scenario
{
    "status": "1",
    "PaymentId": "823201000100006",
    "PaymentPageUrl": "https://staging.logibiztech.com:8777/transaction/mvc/payment"
}
Failure scenario
{
    "errorCode": "LOG- 7",
    "errorDesc": "DuplicateMerchantReferenceID",
    "message": "DUPLICATE_MERCHANT_REF_ID"
}

Re-direct to payment page

Paybiz Payment gateway internally validates the request and gives payment ID and payment page URL in the response in case of successful validation, if failure then error code and description will be provided.

 

private String request() throws IOException {
	URL url = new URL("https://staging.logibiztech.com:8777/transaction/mvc/payment/t2/Jy1dTheUgNtdwOPg_skJSw ==");
	HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
	conn.setRequestMethod("GET");
        conn.setRequestProperty("Authorization",
    "Bearer OGE4Mjk0MTc0YjdlY2IyODAxNGI5Njk5MjIwMDE1Y2N8c3k2S0pzVDg=");
	int responseCode = conn.getResponseCode();
	InputStream is;

	if (responseCode >= 400) is = conn.getErrorStream();
	else is = conn.getInputStream();

	return IOUtils.toString(is);
}

 

Upon redirection to the Payment page, the currently authenticated Apple Wallet ID on the consumer device will be dynamically presented, providing the user with the capability to execute secure transactions through the Apple Pay framework. Subsequently, when the user clicks on the ‘Pay’ button, the payment gateway will manage all internal calls and processing before returning a response.

Response

Success scenario
{
    "responseMessage": "PaymentSuccessful",
    "status": "SUCCESS",
    "merchantRefId": "6566666666",
    "token": "",
    "paymentId": "823203499820001",
    "txnTime": "2023-07-2201:53:02PM",
    "amount": "200.0",
    "authCode": "000000",
    "responseCode": "00",
    "rrn": "139022961549"
}
Failure scenario
{
    "responseMessage": "RISK-001:Cardnumber is in Declined Card list",
    "status": "RISK_FAILED",
    "merchantRefId": "000083423",
    "token": "",
    "paymentId": "823202511610001",
    "trxnTime": "2023-07-21 02: 12: 41 PM",
    "amount": "130.0"
}