Migrating from Android SDK v1.1.0 to v2.x.x

  Last updated: 

 

The following documentation explains what has changed between v1.1.0 and v2.x.x of the Android SDK and what to consider when migrating to the latest version.

 

Changes in v2.x.x

We have updated the parameters that are returned on payment completion. This now includes:

  • List of request responses.
  • The field threedresponse (if present).
  • Any errors that have occurred.
v2.x.x response v1.1.0 response
data class Response(
val responseJwtList: List<String> = emptyList(),
val threeDResponse: ThreeDResponse? = null,
val error: Error? = null)

In v1.1.0, as part of the Success and TransactionFailure objects, we returned a parsed transaction response object.

However, in v2.x.x, we only have one Response object, because we wanted to provide our merchants more control over how they interpret the response.

Example scenario

In v1.1.0, a request of “THREEDQUERY”,”AUTH”,”SUBSCRIPTION” where the THREEDQUERY and AUTH were successful, but the SUBSCRIPTION encountered an error, then the SDK would return a TransactionFailure object, despite the THREEDQUERY and AUTH having been processed successfully. Displaying an error message to the customer in this particular scenario may be misleading, because funds had been reserved against their bank account.

To reduce the chance of the customer being misinformed about the result of the payment transaction, in v2.x.x we no longer distinguish between success and failure in this way, and we will now only return the full list of results that you must first verify, parse and then analyse the errorcode returned in each of the responses.

In regards to the scenario above, you could configure your system to treat the THREEDQUERY and AUTH responses as a success and display the appropriate response message in the customer’s browser (to indicate funds were reserved for payment), but also display an error message to inform them that the automated subscription payments have yet to be scheduled due to an error, and that the customer is recommended to contact you for assistance.

Before information in the response object can be trusted, you must verify the signature of each JWT response.

We provide a parsing utility to extract the payload field data as part of reviewing the payment response fields:

(Kotlin)

val response: PaymentTransactionManager.Response = paymentTransactionManager.executeSession(paymentSession)

//Every JWT returned from the SDK should be verified before further usage.
for (jwt in response.responseJwtList) {
if (!verifyJwtIntegrity(jwt)) {
throw SecurityException("JWT verification failed!")
}
}

val parsedResponse = ResponseParser.parse(response.responseJwtList)

//Process parsedResponse object in a similar manner as in v1.1.0
Was this article helpful?
0 out of 0 found this helpful