PGW Initialization

Refer to the links below for parameters and code samples for each step:

 

📘

API Method

PGW SDK API Interface

🚧

References

SDK Payment Classes
SDK Payment Enums

 

1. Construct System Initialization Request

To prepare a system initialization request, refer to the parameters below.

📘

Request API Parameters

Refer to: System Initialization Request API Parameters

SystemInitializationRequest systemInitializationRequest = new SystemInitializationRequest();
val systemInitializationRequest = SystemInitializationRequest()
SystemInitializationRequest *systemInitializationRequest = [[SystemInitializationRequest alloc] init];
let systemInitializationRequest: SystemInitializationRequest = SystemInitializationRequest()
Map<String, dynamic> systemInitializationRequest = {};
let systemInitializationRequest = {};

 

2. Retrieve System Initialization Response

To retrieve a system initialization response, refer to the parameters below.

📘

Response API Parameters

Refer to: System Initialization Response API Parameters

PGWSDK.getInstance().systemInitialization(systemInitializationRequest, new APIResponseCallback<SystemInitializationResponse>() {
 
     @Override
     public void onResponse(SystemInitializationResponse response) {
       
         if(response.getResponseCode().equals(APIResponseCode.APISuccess)) {
           
             //Read system initialization response. 
         } else {
           
             //Get error response and display error.
         }
     }
 
     @Override
     public void onFailure(Throwable error) {
       
         //Get error response and display error.
     }
});
PGWSDK.getInstance().systemInitialization(systemInitializationRequest, object : APIResponseCallback<SystemInitializationResponse> {
 
      override fun onResponse(response: SystemInitializationResponse) {
 
            if (response.responseCode == APIResponseCode.APISuccess) {
 
                  //Read system initialization response.
            } else {
 
                  //Get error response and display error.
            }
      }
 
      override fun onFailure(error: Throwable) {
 
           //Get error response and display error.
      }
})
[[PGWSDK shared] systemInitializationWithSystemInitializationRequest: systemInitializationRequest response: ^(SystemInitializationResponse * _Nonnull response) {    
  
     if([response.responseCode isEqualToString: APIResponseCode.APISuccess]) {
       
          //Read system initialization response.
     } else {
       
         //Get error response and display error.
     }
} failure: ^(NSError * _Nonnull error) {  
  
     //Get error response and display error.
}];
PGWSDK.shared.systemInitialization(systemInitializationRequest: systemInitializationRequest, { (response: SystemInitializationResponse) in
                                                                                              
     if response.responseCode == APIResponseCode.APISuccess {
       
          //Read system initialization response.
     } else {
       
          //Get error response and display error.
     }
}) { (error: NSError) in
    
     //Get error response and display error.
}
PGWSDK().systemInitialization(systemInitializationRequest, (response) {
 
   if (response['responseCode'] == APIResponseCode.apiSuccess) {
 
      //Read system initialization response.
   } else {
 
      //Get error response and display error.
   }
}, (error) {
 
   //Get error response and display error.
});
await RTNPGW.systemInitialization(JSON.stringify(systemInitializationRequest)).then((response: string) => {
   
    let systemInitializationResponse = JSON.parse(response);
 
    if (systemInitializationResponse?.responseCode == APIResponseCode.apiSuccess) {
 
        //Read system initialization response.
    } else {
 
        //Get error response and display error
    }
}).catch ((error: Error) => {
 
    //Get error response and display error
});

 

Full Sample Code

The following sample code demonstrates requests and parameters for each step of the process.

//Step 1: Construct system initialization request.
SystemInitializationRequest systemInitializationRequest = new SystemInitializationRequest();
 
//Step 2: Retrieve system initialization response.
PGWSDK.getInstance().systemInitialization(systemInitializationRequest, new APIResponseCallback<SystemInitializationResponse>() {
 
     @Override
     public void onResponse(SystemInitializationResponse response) { 
       
         if(response.getResponseCode().equals(APIResponseCode.APISuccess)) {
           
             //Read system initialization response. 
         } else {
           
             //Get error response and display error.
         }
     }
 
     @Override
     public void onFailure(Throwable error) {
       
         //Get error response and display error.
     }
});
//Step 1: Construct system initialization request.
val systemInitializationRequest = SystemInitializationRequest()
 
//Step 2: Retrieve system initialization response.
PGWSDK.getInstance().systemInitialization(systemInitializationRequest, object : APIResponseCallback<SystemInitializationResponse> {
 
      override fun onResponse(response: SystemInitializationResponse) {
 
            if (response.responseCode == APIResponseCode.APISuccess) {
 
                  //Read system initialization response.
            } else {
 
                  //Get error response and display error.
            }
      }
 
      override fun onFailure(error: Throwable) {
 
           //Get error response and display error.
      }
})
//Step 1: Construct payment option request.
SystemInitializationRequest *systemInitializationRequest = [[SystemInitializationRequest alloc] init];
     
//Step 2: Retrieve system initialization response.
[[PGWSDK shared] systemInitializationWithSystemInitializationRequest: systemInitializationRequest response: ^(SystemInitializationResponse * _Nonnull response) {  
  
     if([response.responseCode isEqualToString: APIResponseCode.APISuccess]) {
       
          //Read system initialization response.
     } else {
       
         //Get error response and display error.
     }
} failure: ^(NSError * _Nonnull error) { 
  
     //Get error response and display error.
}];
//Step 1: Construct system initialization request.
let systemInitializationRequest: SystemInitializationRequest = SystemInitializationRequest()
         
//Step 2: Retrieve system initialization response.
PGWSDK.shared.systemInitialization(systemInitializationRequest: systemInitializationRequest, { (response: SystemInitializationResponse) in
                                                                                              
     if response.responseCode == APIResponseCode.APISuccess {
       
          //Read system initialization response.
     } else {
       
          //Get error response and display error.
     }
}) { (error: NSError) in
    
     //Get error response and display error.
}
//Step 1: Construct system initialization request.
Map<String, dynamic> systemInitializationRequest = {};
 
//Step 2: Retrieve system initialization response.
PGWSDK().systemInitialization(systemInitializationRequest, (response) {
 
   if (response['responseCode'] == APIResponseCode.apiSuccess) {
 
      //Read system initialization response.
   } else {
 
      //Get error response and display error.
   }
}, (error) {
 
   //Get error response and display error.
});
//Step 1: Construct system initialization request.
let systemInitializationRequest = {};
 
//Step 2: Retrieve system initialization response.
await RTNPGW.systemInitialization(JSON.stringify(systemInitializationRequest)).then((response: string) => {
   
    let systemInitializationResponse = JSON.parse(response);
 
    if (systemInitializationResponse?.responseCode == APIResponseCode.apiSuccess) {
 
        //Read system initialization response.
    } else {
 
        //Get error response and display error
    }
}).catch ((error: Error) => {
 
    //Get error response and display error
});