Customer Address For Payment

Merchants who store customers' billing address information may fill in those details during the customer's checkout process using this API.

📘

API Method

PGW SDK API Interface

🚧

References

SDK Payment Classes
SDK Payment Enums


1. Generate Payment Token

To prepare a payment token request, refer to the required parameters below.

📘

Payment Token API

Refer to: Payment Token API

{
    "merchantID": "JT04",
    "invoiceNo": "1595219400",
    "description": "2 days 1 night hotel room",
    "amount": 10.0,
    "currencyCode": "THB",
    "nonceStr": "a8092512-b144-41b0-8284-568bb5e9264c",
    "paymentChannel": ["GCARD"],
    "request3DS" : "Y"
}

2. Receive Payment Token Response

To receive a payment token response, refer to the sample payment token response below.

String paymentToken = "roZG9I1hk/GYjNt+BYPYbxQtKElbZDs9M5cXuEbE+Z1ZVTsOqiwXIfPQP1G2x7Ct7lH5ueUnt2TUdoT6FlZqf8hTUV9NxDmJk99mSNHpDs052ujwv+TXtnZ2OfJ0WZEl";
val paymentToken = "roZG9I1hk/GYjNt+BYPYbxQtKElbZDs9M5cXuEbE+Z0QTr/yUcl1oG7t0AGoOJlBhzeyBtf5mQi1UqGbjC66E85S4m63CfV/awwNbbLbkxsvfgzn0KSv7JzH3gcs/OIL"
NSString *paymentToken = @"roZG9I1hk/GYjNt+BYPYbxQtKElbZDs9M5cXuEbE+Z1ZVTsOqiwXIfPQP1G2x7Ct7lH5ueUnt2TUdoT6FlZqf8hTUV9NxDmJk99mSNHpDs052ujwv+TXtnZ2OfJ0WZEl";
let paymentToken: String = "roZG9I1hk/GYjNt+BYPYbxQtKElbZDs9M5cXuEbE+Z1ZVTsOqiwXIfPQP1G2x7Ct7lH5ueUnt2TUdoT6FlZqf8hTUV9NxDmJk99mSNHpDs052ujwv+TXtnZ2OfJ0WZEl"
String paymentToken = 'roZG9I1hk/GYjNt+BYPYbxQtKElbZDs9M5cXuEbE+Z0QTr/yUcl1oG7t0AGoOJlBhzeyBtf5mQi1UqGbjC66E85S4m63CfV/awwNbbLbkxsvfgzn0KSv7JzH3gcs/OIL';
let paymentToken = 'roZG9I1hk/GYjNt+BYPYbxQtKElbZDs9M5cXuEbE+Z0QTr/yUcl1oG7t0AGoOJlBhzeyBtf5mQi1UqGbjC66E85S4m63CfV/awwNbbLbkxsvfgzn0KSv7JzH3gcs/OIL';

3. Prepare Customer Billing Address Infomation

To prepare the customer's billing address, refer to the parameters below.

📘

Payment Request Parameter

Refer to: Payment Request API Parameter

UserBillingAddress userBillingAddress = new UserBillingAddress();
userBillingAddress.setAddress1("128 Beach Road");
userBillingAddress.setAddress2("#21-04");
userBillingAddress.setAddress3("Guoco Midtown");
userBillingAddress.setCity("Singapore");
userBillingAddress.setCountryCode("SG");
userBillingAddress.setPostalCode("189773");
userBillingAddress.setState("Singapore");
 
UserAddress userAddress = new UserAddressBuilder()
                          .setUserBillingAddress(userBillingAddress)
                          .build();
val userBillingAddress = UserBillingAddress().apply {
       address1 = "128 Beach Road"
       address2 = "#21-04"
       address3 = "Guoco Midtown"
       city = "Singapore"
       countryCode = "SG"
       postalCode = "189773"
       state = "Singapore"
}
 
val userAddress: UserAddress = UserAddressBuilder().apply {
       userBillingAddress(userBillingAddress)
}.build()
UserBillingAddress *userBillingAddress = [UserBillingAddress alloc];
userBillingAddress.address1 = @"128 Beach Road";
userBillingAddress.address2 = @"#21-04";
userBillingAddress.address3 = @"Guoco Midtown";
userBillingAddress.city = @"Singapore";
userBillingAddress.countryCode = @"SG";
userBillingAddress.postalCode = @"189773";
userBillingAddress.state = @"Singapore";
 
UserAddress *userAddress = [[[UserAddressBuilder alloc]
                              userBillingAddress: userBillingAddress]
                              build];
let userBillingAddress: UserBillingAddress = UserBillingAddress()
userBillingAddress.address1 = "128 Beach Road"
userBillingAddress.address2 = "#21-04"
userBillingAddress.address3 = "Guoco Midtown"
userBillingAddress.city = "Singapore"
userBillingAddress.countryCode = "SG"
userBillingAddress.postalCode = "189773"
userBillingAddress.state = "Singapore"
         
let userAddress: UserAddress = UserAddressBuilder()
                               .userBillingAddress(userBillingAddress)
                               .build()
Map<String, dynamic> userAddress = {
   'billingAddress1': '128 Beach Road',
   'billingAddress2': '#21-04',
   'billingAddress3': 'Guoco Midtown',
   'billingCity': 'Singapore',
   'billingState': 'Singapore',
   'billingPostalCode': '189773',
   'billingCountryCode': 'SG'
};
let userAddress = {
   'billingAddress1': '128 Beach Road',
   'billingAddress2': '#21-04',
   'billingAddress3': 'Guoco Midtown',
   'billingCity': 'Singapore',
   'billingState': 'Singapore',
   'billingPostalCode': '189773',
   'billingCountryCode': 'SG'
 };

4. Construct Customer Address Payment Request

Set the customer address in the request, refer to the parameters below.

PaymentCode paymentCode = new PaymentCode("CC");
 
PaymentRequest paymentRequest = new CardPaymentBuilder(paymentCode, "4111111111111111")
                                .setExpiryMonth(12)
                                .setExpiryYear(2026)
                                .setSecurityCode("123")
                                .setUserAddress(userAddress)
                                .build();
val paymentCode = PaymentCode("CC")
 
val paymentRequest = CardPaymentBuilder(paymentCode, "4111111111111111").apply {
       expiryMonth(12)
       expiryYear(2026)
       securityCode("123")
       userAddress(userAddress)
}.build()
PaymentCode *paymentCode = [[PaymentCode alloc] initWithChannelCode: @"CC"];
 
PaymentRequest *paymentRequest = [[[[[[[CardPaymentBuilder alloc] initWithPaymentCode: paymentCode cardNo: @"4111111111111111"]
                                        expiryMonth: 12]
                                        expiryYear: 2026]
                                        securityCode: @"123"]
                                        userAddress: userAddress]
                                        build];
let paymentCode: PaymentCode = PaymentCode(channelCode: "CC")
 
let paymentRequest: PaymentRequest = CardPaymentBuilder(paymentCode: paymentCode, "4111111111111111")
                                     .expiryMonth(12)
                                     .expiryYear(2026)
                                     .securityCode("123")
                                     .userAddress(userAddress)
                                     .build()
Map<String, dynamic> paymentCode = {
   'channelCode': 'CC'
};
 
Map<String, dynamic> paymentRequest = {
   'cardNo': '4111111111111111',
   'expiryMonth': 12,
   'expiryYear': 2026,
   'securityCode': '123',
   ...userAddress
};
let paymentCode = {
   'channelCode': 'CC'
};
 
let paymentRequest = {
   'cardNo': '4111111111111111',
   'expiryMonth': 12,
   'expiryYear': 2026,
   'securityCode': '123',
   ...userAddress
};

5. Construct Payment Transaction Request

To prepare a payment transaction request, refer to the parameters below.

📘

Payment Transaction Request API Parameters

Refer to: Do Payment Request API Parameters

TransactionResultRequest transactionResultRequest = new TransactionResultRequestBuilder(paymentToken)
                                                    .with(paymentRequest)
                                                    .build();
val transactionResultRequest = TransactionResultRequestBuilder(paymentToken).apply {
       with(paymentRequest)
}.build()
TransactionResultRequest *transactionResultRequest = [[[[TransactionResultRequestBuilder alloc] initWithPaymentToken: paymentToken]
                                                         withPaymentRequest: paymentRequest]
                                                         build];
let transactionResultRequest: TransactionResultRequest = TransactionResultRequestBuilder(paymentToken: paymentToken)
                                                         .with(paymentRequest)
                                                         .build()
Map<String, dynamic> transactionResultRequest = {
   'paymentToken': paymentToken,
   'payment': {
      'code': {
         ...paymentCode
      },
      'data': {
         ...paymentRequest
      }
   }
};
let transactionResultRequest = {
   'paymentToken': paymentToken,
   'payment': {
      'code': {
         ...paymentCode
      },
      'data': {
         ...paymentRequest
      }
   }
};

 

6. Execute Payment Request

To receive a payment transaction request response, refer to the parameters below.

📘

Payment Transaction Response API Parameters

Refer to: Do Payment Response API Parameters

🚧

References

Response Code
To view payment process flows based on response code, refer to: Payment Flow Response Codes

PGWSDK.getInstance().proceedTransaction(transactionResultRequest, new APIResponseCallback<TransactionResultResponse>() {
   
     @Override
     public void onResponse(TransactionResultResponse response) {
   
          if(response.getResponseCode().equals(APIResponseCode.TransactionAuthenticateRedirect) || response.getResponseCode().equals(APIResponseCode.TransactionAuthenticateFullRedirect)) {
   
                String redirectUrl = response.getData(); //Open WebView
          } else if(response.getResponseCode().equals(APIResponseCode.TransactionCompleted)) {
   
               //Inquiry payment result by using invoice no.
          } else {
   
               //Get error response and display error.
          }
     }
   
     @Override
     public void onFailure(Throwable error) {
   
          //Get error response and display error.
     }
});
PGWSDK.getInstance().proceedTransaction(transactionResultRequest, object : APIResponseCallback<TransactionResultResponse> {
  
       override fun onResponse(response: TransactionResultResponse) {
  
              if (response.responseCode == APIResponseCode.TransactionAuthenticateRedirect || response.responseCode == APIResponseCode.TransactionAuthenticateFullRedirect) {
  
                     val redirectUrl = response.data //Open WebView
              } else if (response.responseCode == APIResponseCode.TransactionCompleted) {
  
                     //Inquiry payment result by using invoice no.
              } else {
  
                     //Get error response and display error.
              }
       }
  
       override fun onFailure(error: Throwable) {
  
              //Get error response and display error.
       }
})
[[PGWSDK shared] proceedTransactionWithTransactionResultRequest: transactionResultRequest response: ^(TransactionResultResponse * _Nonnull response) {
             
     if([response.responseCode isEqualToString: APIResponseCode.TransactionAuthenticateRedirect] || [response.responseCode isEqualToString: APIResponseCode.TransactionAuthenticateFullRedirect]) {
                 
          NSString *redirectUrl = response.data; //Open WebView
     } else if([response.responseCode isEqualToString: APIResponseCode.TransactionCompleted]) {
                 
          //Inquiry payment result by using invoice no.
     } else {
                 
          //Get error response and display error.
     }
} failure: ^(NSError * _Nonnull error) {
             
     //Get error response and display error.
}];
PGWSDK.shared.proceedTransaction(transactionResultRequest: transactionResultRequest, { (response: TransactionResultResponse) in
     
     if response.responseCode == APIResponseCode.TransactionAuthenticateRedirect || response.responseCode == APIResponseCode.TransactionAuthenticateFullRedirect {
                  
           let redirectUrl: String = response.data //Open WebView
     } else if response.responseCode == APIResponseCode.TransactionCompleted {
                  
           //Inquiry payment result by using invoice no.
     } else {
                  
           //Get error response and display error.
     }
}) { (error: NSError) in
              
     //Get error response and display error.
}
PGWSDK().proceedTransaction(transactionResultRequest, (response) {
  
   if (response['responseCode'] == APIResponseCode.transactionAuthenticateRedirect || response['responseCode'] == APIResponseCode.transactionAuthenticateFullRedirect) {
  
       String redirectUrl = response['data']; //Open WebView
   } else if (response['responseCode'] == APIResponseCode.transactionCompleted) {
  
       //Inquiry payment result by using invoice no.
   } else {
  
       //Get error response and display error.
   }
}, (error) {
  
    //Get error response and display error.
});
await RTNPGW.proceedTransaction(JSON.stringify(transactionResultRequest)).then((response: string) => {
   
    let transactionResultResponse = JSON.parse(response);
   
    if(transactionResultResponse?.responseCode == APIResponseCode.transactionAuthenticateRedirect || transactionResultResponse?.responseCode == APIResponseCode.transactionAuthenticateFullRedirect) {
   
        let redirectUrl = transactionResultResponse?.data; //Open WebView
    } else if(transactionResultResponse?.responseCode == APIResponseCode.transactionCompleted) {
   
        //Inquiry payment result by using invoice no.
    } else {
   
        //Get error response and display error.
    }
}).catch ((error: Error) => {
   
    //Get error response and display error
});

👍

Callback for PGW Payment Authentication

Refer to: Handle PGW Payment Authentication


7. Initiate Payment Inquiry

To retrieve payment details, merchants must initiate the Payment Inquiry API. Refer to the sample code below.

📘

Payment Inquiry API

Refer to: Payment Inquiry API


Full Sample Code

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

//Step 1: Generate payment token.
String paymentToken = "roZG9I1hk/GYjNt+BYPYbxQtKElbZDs9M5cXuEbE+Z0QTr/yUcl1oG7t0AGoOJlBhzeyBtf5mQi1UqGbjC66E85S4m63CfV/awwNbbLbkxsvfgzn0KSv7JzH3gcs/OIL";
  
//Step 2: Construct customer billing address information.
UserBillingAddress userBillingAddress = new UserBillingAddress();
userBillingAddress.setAddress1("128 Beach Road");
userBillingAddress.setAddress2("#21-04");
userBillingAddress.setAddress3("Guoco Midtown");
userBillingAddress.setCity("Singapore");
userBillingAddress.setCountryCode("SG");
userBillingAddress.setPostalCode("189773");
userBillingAddress.setState("Singapore");
 
UserAddress userAddress = new UserAddressBuilder()
                          .setUserBillingAddress(userBillingAddress)
                          .build();
 
//Step 3: Construct payment request and add user address into request.
PaymentCode paymentCode = new PaymentCode("CC");
 
PaymentRequest paymentRequest = new CardPaymentBuilder(paymentCode, "4111111111111111")
                                .setExpiryMonth(12)
                                .setExpiryYear(2026)
                                .setSecurityCode("123")
                                .setUserAddress(userAddress)
                                .build();
 
//Step 4: Construct transaction request.
TransactionResultRequest transactionResultRequest = new TransactionResultRequestBuilder(paymentToken)
                                                    .with(paymentRequest)
                                                    .build();

//Step 5: Execute payment request.
PGWSDK.getInstance().proceedTransaction(transactionResultRequest, new APIResponseCallback<TransactionResultResponse>() {
   
     @Override
     public void onResponse(TransactionResultResponse response) {
   
          if(response.getResponseCode().equals(APIResponseCode.TransactionAuthenticateRedirect) || response.getResponseCode().equals(APIResponseCode.TransactionAuthenticateFullRedirect)) {
   
                String redirectUrl = response.getData(); //Open WebView
          } else if(response.getResponseCode().equals(APIResponseCode.TransactionCompleted)) {
   
               //Inquiry payment result by using invoice no.
          } else {
   
               //Get error response and display error.
          }
     }
   
     @Override
     public void onFailure(Throwable error) {
   
          //Get error response and display error.
     }
});
//Step 1: Generate payment token.
val paymentToken = "roZG9I1hk/GYjNt+BYPYbxQtKElbZDs9M5cXuEbE+Z0QTr/yUcl1oG7t0AGoOJlBhzeyBtf5mQi1UqGbjC66E85S4m63CfV/awwNbbLbkxsvfgzn0KSv7JzH3gcs/OIL"
 
//Step 2: Construct customer billing address information.
val userBillingAddress = UserBillingAddress().apply {
       address1 = "128 Beach Road"
       address2 = "#21-04"
       address3 = "Guoco Midtown"
       city = "Singapore"
       countryCode = "SG"
       postalCode = "189773"
       state = "Singapore"
}
 
val userAddress: UserAddress = UserAddressBuilder().apply {
       userBillingAddress(userBillingAddress)
}.build()
 
//Step 3: Construct payment request and add user address into request.
val paymentCode = PaymentCode("CC")
 
val paymentRequest = CardPaymentBuilder(paymentCode, "4111111111111111").apply {
       expiryMonth(12)
       expiryYear(2026)
       securityCode("123")
       userAddress(userAddress)
}.build()
 
//Step 4: Construct transaction request.
val transactionResultRequest = TransactionResultRequestBuilder(paymentToken).apply {
       with(paymentRequest)
}.build()
  
//Step 5: Execute payment request.
PGWSDK.getInstance().proceedTransaction(transactionResultRequest, object : APIResponseCallback<TransactionResultResponse> {
  
       override fun onResponse(response: TransactionResultResponse) {
  
              if (response.responseCode == APIResponseCode.TransactionAuthenticateRedirect || response.responseCode == APIResponseCode.TransactionAuthenticateFullRedirect) {
  
                     val redirectUrl = response.data //Open WebView
              } else if (response.responseCode == APIResponseCode.TransactionCompleted) {
  
                     //Inquiry payment result by using invoice no.
              } else {
  
                     //Get error response and display error.
              }
       }
  
       override fun onFailure(error: Throwable) {
  
              //Get error response and display error.
       }
})
//Step 1: Generate payment token.
NSString *paymentToken = @"roZG9I1hk/GYjNt+BYPYbxQtKElbZDs9M5cXuEbE+Z0QTr/yUcl1oG7t0AGoOJlBhzeyBtf5mQi1UqGbjC66E85S4m63CfV/awwNbbLbkxsvfgzn0KSv7JzH3gcs/OIL";

//Step 2: Construct customer billing address information.
UserBillingAddress *userBillingAddress = [UserBillingAddress alloc];
userBillingAddress.address1 = @"128 Beach Road";
userBillingAddress.address2 = @"#21-04";
userBillingAddress.address3 = @"Guoco Midtown";
userBillingAddress.city = @"Singapore";
userBillingAddress.countryCode = @"SG";
userBillingAddress.postalCode = @"189773";
userBillingAddress.state = @"Singapore";
 
UserAddress *userAddress = [[[UserAddressBuilder alloc]
                              userBillingAddress: userBillingAddress]
                              build];
 
//Step 3: Construct payment request and add user address into request.
PaymentCode *paymentCode = [[PaymentCode alloc] initWithChannelCode: @"CC"];
 
PaymentRequest *paymentRequest = [[[[[[[CardPaymentBuilder alloc] initWithPaymentCode: paymentCode cardNo: @"4111111111111111"]
                                        expiryMonth: 12]
                                        expiryYear: 2026]
                                        securityCode: @"123"]
                                        userAddress: userAddress]
                                        build];
 
//Step 4: Construct transaction request.
TransactionResultRequest *transactionResultRequest = [[[[TransactionResultRequestBuilder alloc] initWithPaymentToken: paymentToken]
                                                         withPaymentRequest: paymentRequest]
                                                         build];

//Step 5: Execute payment request.
[[PGWSDK shared] proceedTransactionWithTransactionResultRequest: transactionResultRequest response: ^(TransactionResultResponse * _Nonnull response) {
             
     if([response.responseCode isEqualToString: APIResponseCode.TransactionAuthenticateRedirect] || [response.responseCode isEqualToString: APIResponseCode.TransactionAuthenticateFullRedirect]) {
                 
          NSString *redirectUrl = response.data; //Open WebView
     } else if([response.responseCode isEqualToString: APIResponseCode.TransactionCompleted]) {
                 
          //Inquiry payment result by using invoice no.
     } else {
                 
          //Get error response and display error.
     }
} failure: ^(NSError * _Nonnull error) {
             
     //Get error response and display error.
}];
//Step 1: Generate payment token.
let paymentToken: String = "roZG9I1hk/GYjNt+BYPYbxQtKElbZDs9M5cXuEbE+Z0QTr/yUcl1oG7t0AGoOJlBhzeyBtf5mQi1UqGbjC66E85S4m63CfV/awwNbbLbkxsvfgzn0KSv7JzH3gcs/OIL"

//Step 2: Construct customer billing address information.
let userBillingAddress: UserBillingAddress = UserBillingAddress()
userBillingAddress.address1 = "128 Beach Road"
userBillingAddress.address2 = "#21-04"
userBillingAddress.address3 = "Guoco Midtown"
userBillingAddress.city = "Singapore"
userBillingAddress.countryCode = "SG"
userBillingAddress.postalCode = "189773"
userBillingAddress.state = "Singapore"
         
let userAddress: UserAddress = UserAddressBuilder()
                               .userBillingAddress(userBillingAddress)
                               .build()
    
//Step 3: Construct payment request and add user address into request.
let paymentCode: PaymentCode = PaymentCode(channelCode: "CC")
 
let paymentRequest: PaymentRequest = CardPaymentBuilder(paymentCode: paymentCode, "4111111111111111")
                                     .expiryMonth(12)
                                     .expiryYear(2026)
                                     .securityCode("123")
                                     .userAddress(userAddress)
                                     .build()
         
//Step 4: Construct transaction request.
let transactionResultRequest: TransactionResultRequest = TransactionResultRequestBuilder(paymentToken: paymentToken)
                                                         .with(paymentRequest)
                                                         .build()

//Step 5: Execute payment request.
PGWSDK.shared.proceedTransaction(transactionResultRequest: transactionResultRequest, { (response: TransactionResultResponse) in
     
     if response.responseCode == APIResponseCode.TransactionAuthenticateRedirect || response.responseCode == APIResponseCode.TransactionAuthenticateFullRedirect {
                  
           let redirectUrl: String = response.data //Open WebView
     } else if response.responseCode == APIResponseCode.TransactionCompleted {
                  
           //Inquiry payment result by using invoice no.
     } else {
                  
           //Get error response and display error.
     }
}) { (error: NSError) in
              
     //Get error response and display error.
}
//Step 1: Generate payment token.
String paymentToken = 'roZG9I1hk/GYjNt+BYPYbxQtKElbZDs9M5cXuEbE+Z0QTr/yUcl1oG7t0AGoOJlBhzeyBtf5mQi1UqGbjC66E85S4m63CfV/awwNbbLbkxsvfgzn0KSv7JzH3gcs/OIL';

//Step 2: Construct customer billing address information.
Map<String, dynamic> userAddress = {
   'billingAddress1': '128 Beach Road',
   'billingAddress2': '#21-04',
   'billingAddress3': 'Guoco Midtown',
   'billingCity': 'Singapore',
   'billingState': 'Singapore',
   'billingPostalCode': '189773',
   'billingCountryCode': 'SG'
};
 
//Step 3: Construct payment request and add user address into request.
Map<String, dynamic> paymentCode = {
   'channelCode': 'CC'
};
 
Map<String, dynamic> paymentRequest = {
   'cardNo': '4111111111111111',
   'expiryMonth': 12,
   'expiryYear': 2026,
   'securityCode': '123',
   ...userAddress
};
 
//Step 4: Construct transaction request.
Map<String, dynamic> transactionResultRequest = {
   'paymentToken': paymentToken,
   'payment': {
      'code': {
         ...paymentCode
      },
      'data': {
         ...paymentRequest
      }
   }
};
 
//Step 5: Execute payment request.
PGWSDK().proceedTransaction(transactionResultRequest, (response) {
  
   if (response['responseCode'] == APIResponseCode.transactionAuthenticateRedirect || response['responseCode'] == APIResponseCode.transactionAuthenticateFullRedirect) {
  
       String redirectUrl = response['data']; //Open WebView
   } else if (response['responseCode'] == APIResponseCode.transactionCompleted) {
  
       //Inquiry payment result by using invoice no.
   } else {
  
       //Get error response and display error.
   }
}, (error) {
  
    //Get error response and display error.
});
//Step 1: Generate payment token.
let paymentToken = 'roZG9I1hk/GYjNt+BYPYbxQtKElbZDs9M5cXuEbE+Z0QTr/yUcl1oG7t0AGoOJlBhzeyBtf5mQi1UqGbjC66E85S4m63CfV/awwNbbLbkxsvfgzn0KSv7JzH3gcs/OIL';
 
//Step 2: Construct customer billing address information.
let userAddress = {
   'billingAddress1': '128 Beach Road',
   'billingAddress2': '#21-04',
   'billingAddress3': 'Guoco Midtown',
   'billingCity': 'Singapore',
   'billingState': 'Singapore',
   'billingPostalCode': '189773',
   'billingCountryCode': 'SG'
 };
 
//Step 3: Construct payment request and add user address into request.
let paymentCode = {
   'channelCode': 'CC'
};
 
let paymentRequest = {
   'cardNo': '4111111111111111',
   'expiryMonth': 12,
   'expiryYear': 2026,
   'securityCode': '123',
   ...userAddress
};
 
//Step 4: Construct transaction request.
let transactionResultRequest = {
   'paymentToken': paymentToken,
   'payment': {
      'code': {
         ...paymentCode
      },
      'data': {
         ...paymentRequest
      }
   }
};
 
//Step 5: Execute payment request.
await RTNPGW.proceedTransaction(JSON.stringify(transactionResultRequest)).then((response: string) => {
   
    let transactionResultResponse = JSON.parse(response);
   
    if(transactionResultResponse?.responseCode == APIResponseCode.transactionAuthenticateRedirect || transactionResultResponse?.responseCode == APIResponseCode.transactionAuthenticateFullRedirect) {
   
        let redirectUrl = transactionResultResponse?.data; //Open WebView
    } else if(transactionResultResponse?.responseCode == APIResponseCode.transactionCompleted) {
   
        //Inquiry payment result by using invoice no.
    } else {
   
        //Get error response and display error.
    }
}).catch ((error: Error) => {
   
    //Get error response and display error
});