Transaction Status Inquiry

The Transaction Status API is for retrieve payment result information for display to customer.

Below are steps to retrieve payment options.

Step 1 : Generate Payment Token

Step 2 : Construct Transaction Status Inquiry Request

Step 3 : Retrieve Transaction Status Inquiry Response

Full Sample Code

Β 

πŸ“˜

API Method

PGW SDK API Interface

🚧

References

SDK Payment Classes
SDK Payment Enums

Β 

Step 1 :Generate Payment Token

Β 
1.1 Generate payment token ID.

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

Β 
1.2 Get payment token ID from response and pass it to merchant mobile application.

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

πŸ“˜

Payment Token API

Please refer: Payment Token API

Β 

Step 2 : Construct Transaction Status Inquiry Request

Below code show how to construct transaction status inquiry request.

πŸ“˜

Request API Parameter

Please refer: Transaction Status Request API Parameter

TransactionStatusRequest transactionStatusRequest = new TransactionStatusRequest(paymentToken);
transactionStatusRequest.setAdditionalInfo(true);
TransactionStatusRequest *transactionStatusRequest = [[TransactionStatusRequest alloc] initWithPaymentToken: paymentToken];
transactionStatusRequest.additionalInfo = true;
let transactionStatusRequest: TransactionStatusRequest = TransactionStatusRequest(paymentToken: paymentToken)
transactionStatusRequest.additionalInfo = true

Β 

Step 3 : Retrieve Transaction Status Inquiry Response

Below code show how to retrieve payment status inquiry response.

πŸ“˜

Response API Parameter

Please refer: Transaction Status Response API Parameter

PGWSDK.getInstance().transactionStatus(transactionStatusRequest, new APIResponseCallback<TransactionStatusResponse>() {
 
     @Override
     public void onResponse(TransactionStatusResponse response) {
 
         if(response.getResponseCode().equals(APIResponseCode.TransactionNotFound) || response.getResponseCode().equals(APIResponseCode.TransactionCompleted)) {
             //Read transaction status inquiry response. 
         } else {
             //Get error response and display error.
         }
     }
 
     @Override
     public void onFailure(Throwable error) {
         //Get error response and display error.
     }
});
[[PGWSDK shared] transactionStatusWithTransactionStatusRequest: transactionStatusRequest response: ^(TransactionStatusResponse * _Nonnull response) {
         
     if([response.responseCode isEqualToString: APIResponseCode.TransactionNotFound] || [response.responseCode isEqualToString: APIResponseCode.TransactionCompleted]) {        
          //Read transaction status inquiry response. 
     } else {
          //Get error response and display error.
     }
} failure: ^(NSError * _Nonnull error) {
     //Get error response and display error.
}];
PGWSDK.shared.transactionStatus(transactionStatusRequest: transactionStatusRequest, { (response: TransactionStatusResponse) in
         
     if response.responseCode == APIResponseCode.TransactionNotFound || response.responseCode == APIResponseCode.TransactionCompleted {
          //Read transaction status inquiry response.       
     } else {
          //Get error response and display error.
     }
}) { (error: NSError) in
     //Get error response and display error.
}

Β 

Full Sample Code

Full Sample Code Show below.

//Step 1 : Generate payment token
String paymentToken = "roZG9I1hk/GYjNt+BYPYbxQtKElbZDs9M5cXuEbE+Z0QTr/yUcl1oG7t0AGoOJlBhzeyBtf5mQi1UqGbjC66E85S4m63CfV/awwNbbLbkxsvfgzn0KSv7JzH3gcs/OIL";
 
//Step 2: Construct transaction status inquiry request.
TransactionStatusRequest transactionStatusRequest = new TransactionStatusRequest(paymentToken);
transactionStatusRequest.setAdditionalInfo(true);
 
//Step 3: Retrieve transaction status inquiry response.
PGWSDK.getInstance().transactionStatus(transactionStatusRequest, new APIResponseCallback<TransactionStatusResponse>() {
 
     @Override
     public void onResponse(TransactionStatusResponse response) {
 
         if(response.getResponseCode().equals(APIResponseCode.TransactionNotFound) || response.getResponseCode().equals(APIResponseCode.TransactionCompleted)) {
             //Read transaction status inquiry response. 
         } else {
             //Get error response and display error.
         }
     }
 
     @Override
     public void onFailure(Throwable error) {
         //Get error response and display error.
     }
});
//Step 1 : Generate payment token
NSString *paymentToken = @"roZG9I1hk/GYjNt+BYPYbxQtKElbZDs9M5cXuEbE+Z0QTr/yUcl1oG7t0AGoOJlBhzeyBtf5mQi1UqGbjC66E85S4m63CfV/awwNbbLbkxsvfgzn0KSv7JzH3gcs/OIL";
 
//Step 2: Construct transaction status inquiry request.
TransactionStatusRequest *transactionStatusRequest = [[TransactionStatusRequest alloc] initWithPaymentToken: paymentToken];
transactionStatusRequest.additionalInfo = true;
     
//Step 3: Retrieve transaction status inquiry response.
[[PGWSDK shared] transactionStatusWithTransactionStatusRequest: transactionStatusRequest response: ^(TransactionStatusResponse * _Nonnull response) {
         
     if([response.responseCode isEqualToString: APIResponseCode.TransactionNotFound] || [response.responseCode isEqualToString: APIResponseCode.TransactionCompleted]) {        
          //Read transaction status inquiry response. 
     } 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 transaction status inquiry request.
let transactionStatusRequest: TransactionStatusRequest = TransactionStatusRequest(paymentToken: paymentToken)
transactionStatusRequest.additionalInfo = true
         
//Step 3: Retrieve transaction status inquiry response.
PGWSDK.shared.transactionStatus(transactionStatusRequest: transactionStatusRequest, { (response: TransactionStatusResponse) in
             
     if response.responseCode == APIResponseCode.TransactionNotFound || response.responseCode == APIResponseCode.TransactionCompleted {               
          //Read transaction status inquiry response.       
     } else {               
          //Get error response and display error.
     }
}) { (error: NSError) in
     //Get error response and display error.
}