Verify Transaction
You can verify transaction by passing or tx-ref
, PaymentType
object to ChapaUtil.verifyTransaction()
method
If you don't initialize
ChapaConfiguration
, use can verify transaction using yourtx-ref
andchapa-public-key
ChapaUtil.verifyTransaction("tx-ref", new ChapaVerifyTransactionCallback() {
@Override
public void onResult(boolean verified, @Nullable Transaction transaction) {
if (verified) {
// payment is verified
} else {
// payment is not verified
}
}
@Override
public void onError(ChapaError error) {
// Error occurred in verifying transaction
// TODO your code here
}
});
ChapaUtil.verifyTransaction("tx_ref", object : ChapaVerifyTransactionCallback {
/**
* verify transaction
*
* @param verified true if transaction is verified otherwise false
* @param transaction if verified [Transaction] otherwise null
*/
override fun onResult(verified: Boolean, transaction: Transaction?) {
if (verified) {
// payment is verified
} else {
// payment is not verified
}
}
override fun onError(error: ChapaError?) {
// Error occurred in verifying transaction
// TODO your code here
}
})