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
Type: IllegalStateException
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
Type: IllegalStateException
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
Type: IllegalStateException
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
Type: IllegalStateException
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
Type: IllegalArgumentException
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
Type: IllegalStateException
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
Type: IllegalStateException
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
Type: IllegalStateException
Reason: XPayUtils.activePaymentMethods
mutable list is empty
Solution: call XpayUtils.prepareAmount()
method
before calling XpayUtils.pay()
method which sets XpayUtils.activePaymentMethods
internally
Shipping Information is not found
Type: IllegalStateException
Reason: XPayUtils.ShippingInfo
is null
Solution: Set XpayUtils.ShippingInfo
using ShippingInfo data class.
Example:
XpayUtils.ShippingInfo = ShippingInfo(
"EG", // country
"Cairo", // city
"Down Town", // state
"5", // apartment
"5", // building
"5", // floor
"Falki" // street
);
name value provided is in the wrong format
Type: IllegalArgumentException
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
Type: IllegalArgumentException
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
Type: IllegalArgumentException
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.