Open the payment UI

Create Pay Station Intent

To open the payment UI, pass the token obtained in the previous step to the XPayments.createIntentBuilder SDK method.

Copy
Full screen
Small screen
val intent = XPayments.createIntentBuilder(getContext())
            .accessToken(AccessToken(token))
            .isSandbox(BuildConfig.IS_SANDBOX)
            .build()

Start activity using created Intent

Copy
Full screen
Small screen
startActivityForResult(intent, RC_PAYSTATION)

Parse activity result

Copy
Full screen
Small screen
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
       super.onActivityResult(requestCode, resultCode, data)
       if (requestCode == RC_PAYSTATION) {
           val result = XPayments.Result.fromResultIntent(data)
       }
   }

Continue reading