Errors reference
XpayUtils and some data classes throws exceptions in the following cases:
- You are trying to call a method when there is a required property missing.
- You are trying to set the value of property in the wrong format.
- XPay servers returned an error message.
All errors (except server errors, it's a work in progress) that gets thrown by XPayUtils can be found in this document with the reason explained and steps to solve the error.
apiKey is required
Reason: XPayUtils.apiKey is null
Solution: Set XpayUtils.apiKey with your API Key value
check here to know how to generate an API key.
communityId is required
Reason: XPayUtils.communityId is null
Solution: Set XpayUtils.communityId with your Community ID value
check here to know how to get your Community ID.
variableAmountID is required
Reason: XPayUtils.variableAmountID is null
Solution: Set XpayUtils.apiPaymentId with your API Payment ID
check here to know how to generate an API Payment ID.
Payment method is not set
Reason: XPayUtils.payUsing is null
Solution: Set XpayUtils.payUsing with one of the values found in XpayUtils.activePaymentMethods.
info
Check the examples in Display active payment methods and Set Payment method sections in the Tutorial.
Payment method chosen is not available
Reason: The value found in XPayUtils.payUsing is not found in XpayUtils.activePaymentMethods.
Solution: Set XPayUtils.payUsing with one of the values found in XpayUtils.activePaymentMethods.
info
Check the examples in Display active payment methods and Set Payment method sections in the Tutorial.
Billing information is not found
Reason: XPayUtils.billingInfo is null.
Solution: Set XpayUtils.billingInfo using BillingInfo data class.
Example:
XpayUtils.billingInfo = BillingInfo(
"John Doe",
"j.doe@test.com",
"+201111111111"
);
PaymentOptionsTotalAmounts is not set
Reason: XpayUtils.PaymentOptionsTotalAmounts is null.
XpayUtils.pay() reads the value of the total amount of the payment from XpayUtils.PaymentOptionsTotalAmounts accessors using the value inside XpayUtils.payusing
Solution: call XpayUtils.prepareAmount() method before calling XpayUtils.pay() method which sets XpayUtils.PaymentOptionsTotalAmounts internally.
activePaymentMethods is empty
Reason: XPayUtils.activePaymentMethods mutable list is empty
Solution: call XpayUtils.prepareAmount() method
before calling XpayUtils.pay() method which sets XpayUtils.activePaymentMethods internally
name value provided is in the wrong format
Reason: value passed to name property in BillingInfo did not match the name regex pattern.
Solution: Make sure the value passed to the name property follows the name regex pattern found here.
email value provided is in the wrong format
Reason: value passed to email property in BillingInfo did not match the email regex pattern.
Solution: Make sure the value passed to the email property follows the email regex pattern found here.
phone value provided is in the wrong format
Reason: value passed to phone property in BillingInfo did not match the phone regex pattern.
Solution: Make sure the value passed to the phone property follows the phone regex pattern found here.