1.0.0 • Published 5 years ago

payu-non-seamless-react v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

@payu-india/react-native-biz-sdk

This is react-native UI wrapper built upon PayU's Android and iOS sdk.

For installing it to your project. Follow the below steps.

Installation

$ npm install @payu-india/react-native-biz-sdk --save
$ react-native link @payu-india/react-native-biz-sdk

Usage

import PayUBizSdk from '@payu-india/react-native-biz-sdk';

Creating Params

var params ={
      amount:'<Transaction Amount>',
      key:'<Key provided by PayU>',
      txnid:'<Transaction Id>',
      productinfo:'<Product Information>',
      surl:'<Success url for Android>',
      furl:'<Failure url for Android >',
      ios_surl:'<Success url for iOS>',
      ios_furl:'<Failure url for iOS>',
      udf1:'<Any user defined fields>',
      udf2:'<Any user defined fields>',
      udf3:'<Any user defined fields>',
      udf4:'<Any user defined fields>',
      udf5:'<Any user defined fields>',
      email:'<Customer Email>',
      phone:'<Customer Phone number>',
      firstname:'<Customer First name>',
      lastname:'<Customer Last name>',
      hash:'<Payment Hash>',
      address1:'Customer address 1',
      address2:'Customer address 2',
      custom_note:'Any extra note to be passed',
      city:'Customer city',
      offer_key:'Valid offer key if wish to enable offer',
      enforce_paymethod:'PG code if wish to enforce particular PG',
      cb_config:{   enableReviewOrder:'true/false',
                    enableSurePay:0-3[For Surepay],
                    autoSelectOTP:'true/false'[To select OTP flow],
                    autoApprove:'true/false'[To Auto approve OTP after auto read],
                    disableBackButtonDialog:'true/false'[To Disable back button Dialog],
                    merchantSMSPermission:'true/false'[To enable SMS permission for Android(OS version>=M),
                    viewPortWideEnable:'true/false'[View Port setting for Netbanking],
                    merchantResponseTimeout:[In milliseconds to set surl/furl loading timeout]
                },
      review_order_data:{
        'Order':'Value',
        'Key Name':'Value1'
      }
    }

For information about CustomBrowser Config refer here For information about Review Order refer here

Creating Hashes

var hashes ={
    'vas_for_mobile_sdk':vasHash,
    'payment_related_details_for_mobile_sdk':paymentDetailsHash,
    'payment_source':paymentHash,
    'delete_user_card':deleteCardHash,
    'check_offer_status':offerStatusHash
}

For more information about how to create above hashes refer here

Invoking PayUBizSDK

Call makePayment method available in PayUBizSdk using params and hashes created above. It returns a promise object where on success /failure transaction response can be found using key merchant_response for response being sent by your Surl/Furl and payu_response for response being sent by PayU's Backend. For any other result catch the errorPayment being cancelled by user.

Code sample

PayUBizSdk.makePayment(hashes,params).then(map =>{
        Alert.alert("Response",'Merchant Response \n'+map.merchant_response+'\n Payu Response \n'+map.payu_response);
      }).catch(error =>{
         Alert.alert("response",error.message);
      });
1.0.0

5 years ago