PGW SDK for React Native

The 2C2P Payment Gateway (PGW) SDK For React Native simplified integration solution for flutter platform with 2C2P Payment Gateway (PGW) SDK, 2C2P Payment Gateway (PGW) UI SDK and 2C2P Payment Gateway (PGW) SDK Helper.

Prerequisite

Add these to your package.json file:

npm install @2c2p/[email protected]
yarn add @2c2p/[email protected]

Import react native classes:

import RTNPGW, { 
    APIEnvironment,
    APIResponseCode, 
    ApplePayPaymentResponseCode,
    DeepLinkPaymentResponseCode,
    GooglePayAPIEnvironment,
    GooglePayPaymentResponseCode,
    InstallmentInterestTypeCode,
    PaymentCustomDataCode,
    PaymentChannelCode,
    PaymentInputCode,
    PaymentNotificationPlatformCode,
    PaymentUIResponseCode,
    QRTypeCode,
    ZaloPayAPIEnvironment,
    ZaloPayPaymentResponseCode
} from '@2c2p/pgw-sdk-react-native';
  • Android:

Step 1: Update your Android project application build.gradle file.

Step 2: Update your Android project build.gradle file.

Step 3: Toggle for build architecture in Android project gradle.properties file.

New architecture: newArchEnabled=true
Old architecture: newArchEnabled=false

Step 4: Add into your Android project proguard file.

#React Native
-keep class com.facebook.react.** { *; }
-keepnames class com.facebook.react.* { *; }
-keepnames interface com.facebook.react.* { *; }

#PGWReactNative
-keep class com.ccpp.pgw.sdk.reactnative.** { *; }
-keepnames class com.ccpp.pgw.sdk.reactnative.* { *; }
-keepnames interface com.ccpp.pgw.sdk.reactnative.* { *; }

#React Native Plugins
-keep class com.swmansion.rnscreens.** { *; }
-keepnames class com.swmansion.rnscreens.* { *; }
-keepnames interface com.swmansion.rnscreens.* { *; }
  • iOS:

Step 1: Execute download dependencies frameworks to iOS project.

npm explore @2c2p/pgw-sdk-react-native -- npm run ios-frameworks
cd node_modules/@2c2p/pgw-sdk-react-native && yarn run ios-frameworks && cd ../../..

Step 2: Go to iOS folder.

cd ios

Step 3: Execute pod bundle install.

New architecture: RCT_NEW_ARCH_ENABLED=1 bundle exec pod install
Old architecture: RCT_NEW_ARCH_ENABLED=0 bundle exec pod install

Step 4: Add deep link payment handle into your iOS Runner.xcodeproj. [Here]

Step 5: Add Apple Pay handle into your iOS Runner.xcodeproj. [Here]

Step 6: Add required info to your project Info.plist for Payment UI feature. [Here]

System Requirements

The SDK has been developed on following platform version:

PlatformMinimum Version
iOS12.4+
Android21+ (OS 5.0)
React Native0.70.0+

Changelog

VersionDescriptionResource
4.0.1- Implement with PGW SDK v4.7.1, PGW SDK Helper v4.2.1 and PGW UI SDK v4.0.3 features.- Download
4.0.0- Implement with PGW SDK v4.7.0, PGW SDK Helper v4.2.1 and PGW UI SDK v4.0.2 features.- Download