Integrate SDK on application side

  1. Implement the logic of getting payment tokens in one of the following ways:
    • Using the Store library (recommended):
      1. To purchase a single item, call the createOrderByItemSku method.
      2. To purchase the items in the cart:
        1. After the user has filled the cart, call the fillCurrentCartWithItems method.
        2. Call the createOrderFromCartById or createOrderFromCurrentCart method.

    • Using the IGS & BB API.
    • Using your own server methods or BaaS solution methods.

  1. Implement the logic of payment UI opening:

Note
Review the demo project for an implementation example.
Copy
Full screen
Small screen
XPayments.createIntentBuilder(this)
    .accessToken(AccessToken(token))
    .isSandbox(BuildConfig.IS_SANDBOX)
    .build()
startActivityForResult(intent, RC_PAYSTATION)

  1. Implement payment result handling:

Copy
Full screen
Small screen
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
    super.onActivityResult(requestCode, resultCode, data)
    if (requestCode == RC_PAYSTATION) {
        val (status, _) = XPayments.Result.fromResultIntent(data)
        when (status) {
            XPayments.Status.COMPLETED -> showSnack(getString(R.string.payment_completed))
            XPayments.Status.CANCELLED -> showSnack(getString(R.string.payment_cancelled))
            XPayments.Status.UNKNOWN -> showSnack(getString(R.string.payment_unknown))
        }
    }
}

Note
Review the demo project for an implementation example.
Your progress
Thank you for your feedback!
Last updated: August 8, 2022

Found a typo or other text error? Select the text and press Ctrl+Enter.

Report a problem
We always review our content. Your feedback helps us improve it.
Provide an email so we can follow up
Thank you for your feedback!