React Native | Novalnet Docs

 React Native

Mobile commerce of late has been on the rise, Novalnet allows it's customers to use React Native as one of the key components. This option allows merchants to integrate seamlessly with their Mobile customers. Setting up almost all the state-of-the-art payment methods haven't been so easy before, as you can now use Novalnet's customizable hosted payment page in your mobile app.

React Native combines the best parts of native development with React, a best-in-class JavaScript library for building user interfaces.

How does it work?

When the customer clicks on the order button in his/her mobile app to confirm the purchase, Novalnet's hosted payment form will be displayed into the app as WebView. The customer can choose the preferred payment type and once the customer completes the payment process, you will receive the payment result to your corresponding return URL's (transaction.return_url, transaction.error_return_url). Besides that, you can perform the /transaction/details API call to retrieve the additional transaction result

Requirements

To implement this methodology, you need to have the following libraries installed in your server

  1. react-native-webview
  2. react-native-base64

Steps to complete the purchase via WebView

Follow the below steps for the integration via mobile app using React Native:

Step 1: Generating payment URL

Post all the required transaction parameters to Novalnet in advance without the user interaction, thus submitting all the transaction based data (user/order details, merchant credentials, etc. other than the sensitive payment data) through server call, to create the payment URL (hosted at Novalnet server).

Merchant-defined identifier for the capture request. Used for tracking, reconciliation, auditing, or mapping the capture to an internal order, invoice, or reference ID.

The sample in the steps below will contain only the minimal parameters for the demo execution and explanation. To know more about all the parameters, it's descriptions, header explanation and results, refer this >>link<<.

Customization of payment page with your choice of layout & design

The payment page hosted at Novalnet is completely customizable with respect to the layout and design, you can adjust it as per your desire. Please refer the hosted_page block on the parameter reference link to customize the layout per stylesheet, header, footer, etc.

Step 2: Loading the payment form in the mobile APP

Once the payment URL is created successfully, you can render the payment page as WebView in your mobile APP.


The hosted payment form from Novalnet will be rendered in the following way as WebView,



You can also download the sample code file for the React Native JS from the >>link<<

Step 3: Receiving / Handling payment status

On successful completion of payment, the user will be redirected to the given transaction.return_url passed in the initial payment URL generation request (refer Step 1 above).

The decision making about the WebView result will solely depend on the parameter status under the object result. The parameter can take up either of the values SUCCESS or FAILURE.


Retrieving all the transaction details (optional)

If you are already handling webhook process, this step is not required, because your webhook receives all the transaction details.

The WebView response will give you only the minimum details about the transaction, to retrieve entire transaction details, make the /transaction/details API by using the tid returned in the WebView response from Step 2

To know more about the parameters, sample codes and results for retrieving the transaction details API, refer to this >>link<<