ZaloPay Wallet

The 2C2P PGW SDK allows merchants to accept payments from e-wallets such as ZaloPay.

The ZaloPay digital wallet can be topped up and used for payments across the Vietnam.

📘

API Method

PGW SDK API Interface

🚧

References

SDK Payment Classes
SDK Payment Enums


1. Prerequisite

Refer all the steps and images from following link.

📘

ZaloPay Prerequisite


2. Generate Payment Token

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

📘

Payment Token API

Refer to: Payment Token API

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

 

3. Receive Payment Token Response

To receive a payment token response, refer to the sample payment token response below. The response will contain the payment token ID which must be passed to the merchant application.

String paymentToken = "roZG9I1hk/GYjNt+BYPYbxQtKElbZDs9M5cXuEbE+Z0QTr/yUcl1oG7t0AGoOJlBhzeyBtf5mQi1UqGbjC66E85S4m63CfV/awwNbbLbkxsvfgzn0KSv7JzH3gcs/OIL";
val 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"
String paymentToken = 'roZG9I1hk/GYjNt+BYPYbxQtKElbZDs9M5cXuEbE+Z0QTr/yUcl1oG7t0AGoOJlBhzeyBtf5mQi1UqGbjC66E85S4m63CfV/awwNbbLbkxsvfgzn0KSv7JzH3gcs/OIL';
let paymentToken = 'roZG9I1hk/GYjNt+BYPYbxQtKElbZDs9M5cXuEbE+Z0QTr/yUcl1oG7t0AGoOJlBhzeyBtf5mQi1UqGbjC66E85S4m63CfV/awwNbbLbkxsvfgzn0KSv7JzH3gcs/OIL';

4. Prepare Payment Request

To prepare an e-wallet payment request, refer to the sample code below.

📘

Payment Request Parameters

Refer to Payment Request API Parameters

🚧

Payment Channel Matrix

Refer to the below payment channel codes from Digital Payment

PaymentCode paymentCode = new PaymentCode("ZALOPAY");
 
PaymentRequest paymentRequest = new DigitalPaymentBuilder(paymentCode)
                                .setName("DavidBilly")
                                .setEmail("[email protected]")
                                .setMobileNo("0888888888")
                                .build();
val paymentCode = PaymentCode("ZALOPAY")
 
val paymentRequest = DigitalPaymentBuilder(paymentCode).apply {
       name("DavidBilly")
       email("[email protected]")
       mobileNo("0888888888")
}.build()
PaymentCode *paymentCode = [[PaymentCode alloc] initWithChannelCode: @"ZALOPAY"];
          
PaymentRequest *paymentRequest = [[[[[[DigitalPaymentBuilder alloc] initWithPaymentCode: paymentCode]
                                       name: @"DavidBilly"]
                                       email: @"[email protected]"]
                                       mobileNo: @"0888888888"]
                                       build];
let paymentCode: PaymentCode = PaymentCode(channelCode: "ZALOPAY")
 
let paymentRequest: PaymentRequest = DigitalPaymentBuilder(paymentCode: paymentCode)
                                     .name("DavidBilly")
                                     .email("[email protected]")
                                     .mobileNo("0888888888")
                                     .build()
Map<String, dynamic> paymentCode = {
   'channelCode': 'ZALOPAY'
};

Map<String, dynamic> paymentRequest = {
   'name': 'DavidBilly',
   'email': '[email protected]',
   'mobileNo': '0888888888'
};
let paymentCode = {
   'channelCode': 'ZALOPAY'
};

let paymentRequest = {
   'name': 'DavidBilly',
   'email': '[email protected]',
   'mobileNo': '0888888888'
};

5. Prepare Transaction Request

To prepare a transaction request, refer to the parameters and sample code below.

📘

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. Receive Transaction Request Response

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

📘

Transaction Response API Parameter

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.TransactionExternalApplication)) {
    
               //Construct ZaloPay payment request.
          } 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.TransactionExternalApplication) {
 
                        //Construct ZaloPay payment request.
                } 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.TransactionExternalApplication]) {
           
          //Construct ZaloPay payment request.
     } 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.TransactionExternalApplication {
                
           //Construct ZaloPay payment request.
      } else {
                   
           //Get error response and display error.
      }
}) { (error: NSError) in
               
     //Get error response and display error.
}
PGWSDK().proceedTransaction(transactionResultRequest, (response) {
  
   if (response['responseCode'] == APIResponseCode.transactionExternalApplication) {

      //Construct ZaloPay payment request.
   } else {
  
      //Get error response and display error.
   }
}, (error) {
  
    //Get error response and display error.
});
await RTNPGW.proceedTransaction(JSON.stringify(transactionResultRequest)).then(async (response: string) => {
      
    let transactionResultResponse = JSON.parse(response);
      
    if (transactionResultResponse?.responseCode == APIResponseCode.transactionExternalApplication) {
      
        //Construct ZaloPay payment request.
    } else {
      
        //Get error response and display error.
    }
}).catch ((error: Error) => {
      
    //Get error response and display error
});

 

7. Prepare ZaloPay Payment Request

To prepare a ZaloPay payment request, refer to the parameters and sample code below.

📘

Payment Request Parameters

Refer to: Payment Provider Parameters

PaymentProviderRequest paymentProviderRequest = new PaymentProviderBuilder(getActivity())
                                                .setTransactionResultResponse(response)
                                                .build();
val paymentProviderRequest = PaymentProviderBuilder(activity).apply {
       transactionResultResponse(response)
}.build()
PaymentProviderRequest *paymentProviderRequest = [[[[PaymentProviderBuilder alloc] init]
                                                     transactionResultResponse: response]
                                                     build];
let paymentProviderRequest: PaymentProviderRequest = PaymentProviderBuilder()
                                                     .transactionResultResponse(response)
                                                     .build()       
PGWSDKHelper().proceedZaloPayPayment(response, ZaloPayAPIEnvironment.sandbox, (response))
await RTNPGW.proceedZaloPayPayment(response, ZaloPayAPIEnvironment.production).then((response: string))

 

8. Receive ZaloPay Payment Request Response

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

📘

Payment Request Response Parameter

Refer to: ZaloPay Payment Result Response Parameters

PGWSDKHelper.getInstance().proceedZaloPayPayment(paymentProviderRequest, new PaymentResultResponseCallback<ZaloPayPaymentResultResponse>() {

   @Override
   public void onResponse(ZaloPayPaymentResultResponse response) {
              
        if(response.getResponseCode().equalsIgnoreCase(ZaloPayPaymentResponseCode.PaymentSuccess)) {

             //Inquiry payment result by using payment token.
        } else {

             //Get error response and display error.
        }
   }

   @Override
   public void onFailure(Throwable error) {

        //Get error response and display error.
   }
});
PGWSDKHelper.getInstance().proceedZaloPayPayment(paymentProviderRequest, object : PaymentResultResponseCallback<ZaloPayPaymentResultResponse> {
 
       override fun onResponse(response: ZaloPayPaymentResultResponse) {
 
              if (response.responseCode == ZaloPayPaymentResponseCode.PaymentSuccess) {
 
                     //Inquiry payment result by using payment token.
              } else {
 
                     //Get error response and display error.
              }
       }
 
       override fun onFailure(error: Throwable) {
 
              //Get error response and display error.
       }
})
[[PGWSDKHelper shared] proceedZaloPayPaymentWithPaymentProviderRequest: paymentProviderRequest response: ^(ZaloPayPaymentResultResponse * _Nonnull response) {

     if([response.responseCode isEqualToString: ZaloPayPaymentResponseCode.PaymentSuccess]) {
            
           //Inquiry payment result by using payment token.
     } else {
            
           //Get error response and display error.
     }
 } failure: ^(NSError * _Nonnull error) {
         
      //Get error response and display error.
 }];  
PGWSDKHelper.shared.proceedZaloPayPayment(paymentProviderRequest: paymentProviderRequest, { (response: ZaloPayPaymentResultResponse) in

      if response.responseCode == ZaloPayPaymentResponseCode.PaymentSuccess {

           //Inquiry payment result by using payment token.
      } else {
       
           //Get error response and display error.
      }
 }) { (error: NSError) in

       //Get error response and display error.
 }  
PGWSDKHelper().proceedZaloPayPayment(response, ZaloPayAPIEnvironment.sandbox, (response) {
 
   if (response['responseCode'] == ZaloPayPaymentResponseCode.paymentSuccess) {

      //Inquiry payment result by using payment token.
   } else {
            
      //Get error response and display error.
   }
}, (error) {

   //Get error response and display error.
});
await RTNPGW.proceedZaloPayPayment(response, ZaloPayAPIEnvironment.production).then((response: string) => {
 
    let zaloPayPaymentResultResponse = JSON.parse(response);
 
    if (zaloPayPaymentResultResponse?.responseCode == ZaloPayPaymentResponseCode.paymentSuccess) {
 
        //Inquiry payment result by using payment token.
    } else {
                     
        //Get error response and display error.
     }
}).catch ((error: Error) => {
 
     //Get error response and display error.
});

9. Initiate Payment Inquiry

To retrieve payment details and status, 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 requests and parameters for each step of the process.

//Step 1: Generate payment token.
String paymentToken = "roZG9I1hk/GYjNt+BYPYbxQtKElbZDs9M5cXuEbE+Z0QTr/yUcl1oG7t0AGoOJlBhzeyBtf5mQi1UqGbjC66E85S4m63CfV/awwNbbLbkxsvfgzn0KSv7JzH3gcs/OIL";
    
//Step 2: Construct e-wallet request
PaymentCode paymentCode = new PaymentCode("ZALOPAY");
 
PaymentRequest paymentRequest = new DigitalPaymentBuilder(paymentCode)
                                .setName("DavidBilly")
                                .setEmail("[email protected]")
                                .setMobileNo("08888888")
                                .build();
    
//Step 3: Construct transaction request.
TransactionResultRequest transactionResultRequest = new TransactionResultRequestBuilder(paymentToken)
                                                    .with(paymentRequest)
                                                    .build();
    
//Step 4: Execute payment request.
PGWSDK.getInstance().proceedTransaction(transactionResultRequest, new APIResponseCallback<TransactionResultResponse>() {
    
     @Override
     public void onResponse(TransactionResultResponse response) {
    
          if(response.getResponseCode().equals(APIResponseCode.TransactionExternalApplication)) {
    
               //Step 5: Construct ZaloPay payment request.
               PaymentProviderRequest paymentProviderRequest = new PaymentProviderBuilder(getActivity())
                                                               .setTransactionResultResponse(response)
                                                               .build();
 
               PGWSDKHelper.getInstance().proceedZaloPayPayment(paymentProviderRequest, new PaymentResultResponseCallback<ZaloPayPaymentResultResponse>() {
 
                  @Override
                  public void onResponse(ZaloPayPaymentResultResponse response) {
                             
                       if(response.getResponseCode().equalsIgnoreCase(ZaloPayPaymentResponseCode.PaymentSuccess)) {
 
                            //Inquiry payment result by using payment token.
                       } else {
 
                            //Get error response and display error.
                       }
                  }
 
                  @Override
                  public void onFailure(Throwable error) {
 
                       //Get error response and display error.
                  }
              });
          } 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 e-wallet request.
val paymentCode = PaymentCode("ZALOPAY")
  
val paymentRequest = DigitalPaymentBuilder(paymentCode).apply {
       name("DavidBilly")
       email("[email protected]")
       mobileNo("0888888888")
}.build()
     
//Step 3: Construct transaction request.
val transactionResultRequest = TransactionResultRequestBuilder(paymentToken).apply {
       with(paymentRequest)
}.build()
 
//Step 4: Execute payment request.
PGWSDK.getInstance().proceedTransaction(transactionResultRequest, object : APIResponseCallback<TransactionResultResponse> {
 
        override fun onResponse(response: TransactionResultResponse) {
 
                if (response.responseCode == APIResponseCode.TransactionExternalApplication) {
 
                        //Step 5: Construct ZaloPay payment request.
                        val paymentProviderRequest = PaymentProviderBuilder(activity).apply {
                                transactionResultResponse(response)
                        }.build()
 
                        PGWSDKHelper.getInstance().proceedZaloPayPayment(paymentProviderRequest, object : PaymentResultResponseCallback<ZaloPayPaymentResultResponse> {
 
                                override fun onResponse(response: ZaloPayPaymentResultResponse) {
 
                                        if (response.responseCode == ZaloPayPaymentResponseCode.PaymentSuccess) {
 
                                                //Inquiry payment result by using payment token.
                                        } else {
 
                                                //Get error response and display error.
                                        }
                                }
 
                                override fun onFailure(error: Throwable) {
 
                                        //Get error response and display error.
                                }
                        })
                } 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 e-wallet request.
PaymentCode *paymentCode = [[PaymentCode alloc] initWithChannelCode: @"ZALOPAY"];
          
PaymentRequest *paymentRequest = [[[[[[DigitalPaymentBuilder alloc] initWithPaymentCode: paymentCode]
                                       name: @"DavidBilly"]
                                       email: @"[email protected]"]
                                       mobileNo: @"08888888"]
                                       build];
   
//Step 3: Construct transaction request. 
TransactionResultRequest *transactionResultRequest = [[[[TransactionResultRequestBuilder alloc] initWithPaymentToken: paymentToken]
                                                         withPaymentRequest: paymentRequest]
                                                         build];
       
//Step 4: Execute payment request.
[[PGWSDK shared] proceedTransactionWithTransactionResultRequest: transactionResultRequest response: ^(TransactionResultResponse * _Nonnull response) {
              
     if([response.responseCode isEqualToString: APIResponseCode.TransactionExternalApplication]) {
                  
          //Step 5: Construct ZaloPay payment request.
          PaymentProviderRequest *paymentProviderRequest = [[[[PaymentProviderBuilder alloc] init]
                                                               transactionResultResponse: response]
                                                               build];
              
          [[PGWSDKHelper shared] proceedZaloPayPaymentWithPaymentProviderRequest: paymentProviderRequest response: ^(ZaloPayPaymentResultResponse * _Nonnull response) {
   
               if([response.responseCode isEqualToString: ZaloPayPaymentResponseCode.PaymentSuccess]) {
                      
                     //Inquiry payment result by using payment token.
               } else {
                      
                     //Get error response and display error.
               }
           } failure: ^(NSError * _Nonnull error) {
                   
                //Get error response and display error.
           }];        
     } 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 e-wallet request.
let paymentCode: PaymentCode = PaymentCode(channelCode: "ZALOPAY")
 
let paymentRequest: PaymentRequest = DigitalPaymentBuilder(paymentCode: paymentCode)
                                     .name("DavidBilly")
                                     .email("[email protected]")
                                     .mobileNo("08888888")
                                     .build()         
 
//Step 3: Construct transaction request.
let transactionResultRequest: TransactionResultRequest = TransactionResultRequestBuilder(paymentToken: paymentToken)
                                                         .with(paymentRequest)
                                                         .build()
           
//Step 4: Execute payment request.
PGWSDK.shared.proceedTransaction(transactionResultRequest: transactionResultRequest, { (response: TransactionResultResponse) in
      
     if response.responseCode == APIResponseCode.TransactionExternalApplication {
                
           //Step 5: Construct ZaloPay payment request.
           let paymentProviderRequest: PaymentProviderRequest = PaymentProviderBuilder()
                                                               .transactionResultResponse(response)
                                                               .build()
                  
           PGWSDKHelper.shared.proceedZaloPayPayment(paymentProviderRequest: paymentProviderRequest, { (response: ZaloPayPaymentResultResponse) in
 
                if response.responseCode == ZaloPayPaymentResponseCode.PaymentSuccess {
 
                     //Inquiry payment result by using payment token.
                } else {
                 
                     //Get error response and display error.
                }
           }) { (error: NSError) in
 
                 //Get error response and display error.
           }
      } 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 e-wallet request.
Map<String, dynamic> paymentCode = {
   'channelCode': 'ZALOPAY'
};
  
Map<String, dynamic> paymentRequest = {
   'name': 'DavidBilly',
   'email': '[email protected]',
   'mobileNo': '0888888888'
};
  
//Step 3: Construct transaction request.
Map<String, dynamic> transactionResultRequest = {
   'paymentToken': paymentToken,
   'payment': {
      'code': {
        ...paymentCode
      },
      'data': {
        ...paymentRequest
      }
   }
};
  
//Step 4: Execute payment request.
PGWSDK().proceedTransaction(transactionResultRequest, (response) {
  
   if (response['responseCode'] == APIResponseCode.transactionExternalApplication) {
  
      //Step 5: Construct ZaloPay payment request.
      PGWSDKHelper().proceedZaloPayPayment(response, ZaloPayAPIEnvironment.sandbox, (response) {
 
         if (response['responseCode'] == ZaloPayPaymentResponseCode.paymentSuccess) {
 
            //Inquiry payment result by using payment token.
         } else {
                 
            //Get error response and display error.
         }
      }, (error) {
 
         //Get error response and display error.
      });
   } 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 e-wallet request.
let paymentCode = {
   'channelCode': 'ZALOPAY'
};
  
let paymentRequest = {
   'name': 'DavidBilly',
   'email': '[email protected]',
   'mobileNo': '0888888888'
};
  
//Step 3: Construct transaction request.
let transactionResultRequest = {
   'paymentToken': paymentToken,
   'payment': {
      'code': {
        ...paymentCode
      },
      'data': {
        ...paymentRequest
      }
   }
};
  
//Step 4: Execute payment request.
await RTNPGW.proceedTransaction(JSON.stringify(transactionResultRequest)).then(async (response: string) => {
      
    let transactionResultResponse = JSON.parse(response);
      
    if (transactionResultResponse?.responseCode == APIResponseCode.transactionExternalApplication) {
      
        //Step 5: Construct ZaloPay payment request.
        await RTNPGW.proceedZaloPayPayment(response, ZaloPayAPIEnvironment.production).then((response: string) => {
 
            let zaloPayPaymentResultResponse = JSON.parse(response);
 
            if (zaloPayPaymentResultResponse?.responseCode == ZaloPayPaymentResponseCode.paymentSuccess) {
 
                //Inquiry payment result by using payment token.
            } else {
                     
                //Get error response and display error.
            }
        }).catch ((error: Error) => {
 
            //Get error response and display error.
        });
    } else {
      
        //Get error response and display error.
    }
}).catch ((error: Error) => {
      
    //Get error response and display error
});