---
updatedAt: 2025-05-28T08:41:31.000Z
agentTools:
  projectIndex: https://developer.2c2p.com/llms.txt
---

# 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.

```java
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);
    }
}
```
```coffeescript Kotlin
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)
    }
}
```
```objectivec
@import PGW;
 
@implementation AppDelegate
      
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions {
           
        PGWSDKParams *pgwsdkParams = [[[PGWSDKParamsBuilder alloc] initWithApiEnvironment: APIEnvironmentProduction]
                                                                                           build];
     
        [PGWSDK initializeWithParams: pgwsdkParams];
     
        return YES;
    }
@end
```
```swift
import PGW
 
class AppDelegate: UIResponder, UIApplicationDelegate {
     
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
     
        let pgwsdkParams: PGWSDKParams = PGWSDKParamsBuilder(apiEnvironment: APIEnvironment.Production)
                                        .build()
 
        PGWSDK.initialize(params: pgwsdkParams)
      
        return true
    }
}
```
```coffeescript Flutter
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());
  });
}

```
```coffeescript React Native
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.
   });
}
```

> ❗️ Important:
>
> The 2C2P PGW SDK should be initialized using the Application / AppDelegate class