Skip to main content

Webview Module

Main purpose in using this module is to help end user successfully pay via PBL (online payment), or handle additional verification 3DS, PEX, and won't leave the application prematurely. This not means that the cash was transferred from user to merchant - this needs additional time to process. This module consist of Android widget - webview. PBL (Pay By Links) & 3DS are types of payment when user needs to use browser to pay for the purchased products.

Handling PBL Payment:

webview PBL flow chart

  1. Checkout/Payment Process - User select pay with PBL (login to specific bank and pay)
  2. Checkout/Payment Process - At the end of local check out request is send to merchant backend to create an order on PayU side
  3. Checkout/Payment Process - Response from created order is passed from merchant backend to Mobile SDK (via mobile app)
  4. Handle User Payment - payment-library-webview-module check if user paid for shopping using selected bank
  5. Payment Status - Status code is passed to mobile app

Base flow for 3DS looks the same as PBL payments.

Initial conditions:

  • Order with PBL was successfully created and placed.

  • Order Response contained at least redirectUrl.

Order Request with PBL Specified as a Payment Method
{
"continueUrl": "https://your.eshop.com/", // this value can determine path for redirect Url in mobile web components
"notifyUrl": "https://your.eshop.com/notify",
"customerIp": "127.0.0.1",
"merchantPosId": "PosId",
"description": "RTV market",
"currencyCode": "PLN",
"totalAmount": "1000",
"buyer": {
"email": "john.doe@gmail.com",
"phone": "666*****6",
"firstName": "John",
"lastName": "Doe",
"language": "pl"
},
"settings":{
"invoiceDisabled":"true"
},
"products": [
{
"name": "Wireless Mouse for Laptop",
"unitPrice": "500",
"quantity": "1"
}
],
"payMethods":{
"payMethod":{
"type":"PBL",
"value":"o"
}
}
}

Its important to pass correct continueURL parameter to Mobile SDK in order to end payment process.

  • Success Status - it means that the transaction finished successfully on mobile, but merchant need to receive notification from payU backend that bank proceed the payment; the criteria are: last redirect url was continueUrl with query parameteres (without error & without failure keywords) or without any query.

  • Error/Failure Status - it means that the transaction finished with an issue & criteria are: last redirect url was continueUrl with query parameters Error or Failure

After passing URL you are redirected to the financial institution site, because of this you are leaving PayU page for a moment. Any occuring errors e.g. with SSL (this can happen when certificates are wrongly configured or out of date) are not caused by PayU.

Payment Authorization

Currently there is a support for two types of Payment Authorization in WebView:

  • PAY_BY_LINK - when PBL was selected as payment method

  • 3DS - when received "WARNING_CONTINUE_3DS"

Dynamic Configuration

Create object AuthorizationDetails with using AuthorizationDetailsBuilder with setting at least link from redirectUrl & continueUrl:

new AuthorizationDetails.AuthorizationDetailsBuilder()
.withAuthorizationType(PaymentAuthorization._3DS) (or PaymentAuthorization.PAY_BY_LINK)
.withContinueUrl("http://my.shop.pl/") //needed for payments, this url is a property that could be passed
//in OrderCreateRequest or it is a shop page that was verfied by PayU Administrators
.withLink("https://merch-prod.snd.payu.com/np/newpayment.resume.action?paymentId=73443832&hash=1dc257ebb8dbfa3fef322ff40523251b&js=1") //redirect link from OCR request
.build();

It will be good to pass orderId and PaymentId, but this properties are optional and will be returned only if they were passed to mobile SDK (Full list of properties).

Then you can pass the authorization details:

WebPaymentService.pay(activity, authorizationDetails)

Previous, starter Activity will be informed in **onActivityResult() method when payment process will end.

Status Codes in enum
Status CodeDescription
SUCCESS
Successful transaction.
PAYMENT_ERROR
Transaction failed (e.g. timeout).
SSL_VALIDATION_ERROR
Transaction failed - SSL Validation failed for given url. Please contact provider of mentioned web page.
CANCEL_PAYMENT
Transaction cancelled by user.
WARNING_CONTINUE_CVV
Transaction needs to be confirmed by CVV code.

Intent in **onActivityResult() will contain a Parcelable with key: "INTENT_WEB_PAYMENT_EXTRA".

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == WebPaymentService.REQUEST_CODE) {
PaymentDetails paymentDetails = WebPaymentService.extractPaymentResult(data);
Log.v(TAG, paymentDetails.toString());
}
}

In some cases (if your POS is not configurated for this) there could be a need to handle additional payment verification after 3DS payment.

alt_name

In this case WARNING_CONTINUE_CVV will be returned as a payment status. This can be handled by other component - payment-add-card-module.

PEX (Pay by External)

This type of payment works same as PBL.

Only Condition for PEX is OCR created with it as a PaymentType:

"payMethods":{
"payMethod":{
"type":"BANK_TOKEN",
"value":"{pex_token}"
}
}

And response to it with statusCode WARNING_CONTINUE_REDIRECT with redirect url:

{
"orderId": "ZGKCGS ... 01",
"status": {
"statusCode": "WARNING_CONTINUE_REDIRECT"
},
"redirectUri": "....test.payudc.net/np/newpayment"
}

This information should be provided to handle PEX payment type:

new AuthorizationDetails.Builder()
.withLink("...test.payudc.net/np/newpayment")
.withContinueUrl("http://multishop.dev.payudc.net/")
.withAuthorizationType(PaymentAuthorization.PEX)
.build();

and this object should be passed to WebPaymentService:

WebPaymentService.pay(activityContext, authorizationDetails);