Initialize PGW SDK

Initialize the PGW SDK in your application.

Merchants must initialize the 2C2P PGW SDK in their mobile apps before performing any payment transactions. To do so, refer to the sample code below.

import com.ccpp.pgw.sdk.android.builder.PGWSDKParamsBuilder;
import com.ccpp.pgw.sdk.android.core.PGWSDK;
import com.ccpp.pgw.sdk.android.enums.APIEnvironment;
import com.ccpp.pgw.sdk.android.model.core.PGWSDKParams;
 
public class CustomApplication extends Application {
 
    @Override
    public void onCreate() {
        super.onCreate();
 
        PGWSDKParams pgwsdkParams = new PGWSDKParamsBuilder(this, APIEnvironment.Production)
                                    .build();
 
        PGWSDK.initialize(pgwsdkParams);
    }
}
import com.ccpp.pgw.sdk.android.builder.PGWSDKParamsBuilder
import com.ccpp.pgw.sdk.android.core.PGWSDK
import com.ccpp.pgw.sdk.android.enums.APIEnvironment
import com.ccpp.pgw.sdk.android.model.core.PGWSDKParams
 
class CustomApplication : Application() {
 
    override fun onCreate() {
        super.onCreate()
 
        val pgwsdkParams = PGWSDKParamsBuilder(this, APIEnvironment.Production)
                           .build()
 
        PGWSDK.initialize(pgwsdkParams)
    }
}
@import PGW;
 
@implementation AppDelegate
      
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions {
           
        PGWSDKParams *pgwsdkParams = [[[PGWSDKParamsBuilder alloc] initWithApiEnvironment: APIEnvironmentProduction]
                                                                                           build];
     
        [PGWSDK initializeWithParams: pgwsdkParams];
     
        return YES;
    }
@end
import PGW
 
class AppDelegate: UIResponder, UIApplicationDelegate {
     
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
     
        let pgwsdkParams: PGWSDKParams = PGWSDKParamsBuilder(apiEnvironment: APIEnvironment.Production)
                                        .build()
 
        PGWSDK.initialize(params: pgwsdkParams)
    }
}
import 'package:flutter/material.dart';
import 'package:pgw_sdk/core/pgw_sdk_delegate.dart';
import 'package:pgw_sdk/enum/api_environment.dart';
 
void main() async {
 
  Map<String, dynamic> pgwsdkParams = {
     'apiEnvironment': APIEnvironment.production
  };
 
  await PGWSDK().initialize(pgwsdkParams, (error) {
 
     //Get error response and display error.
  }).whenComplete(() {
 
      runApp(const MyApp());
  });
}

import RTNPGW, { APIEnvironment } from '@2c2p/pgw-sdk-react-native';
 
function App(): Promise<React.JSX.Element> {
 
   let pgwsdkParams = {
      'apiEnvironment': APIEnvironment.production
   };
         
   RTNPGW.initialize(JSON.stringify(pgwsdkParams)).then((response: string) => {
     
   }).catch ((error: Error) => {
     
      //Get error response and display error.
   });
}

📘

The 2C2P PGW SDK should be initialized using the Application / AppDelegate class

 

Next : Handle PGW Payment Authentication
Understand client callbacks for handling PGW payment authentication.