Skip to content

[Bug]: Adyen Terminal API: abort API returns a string instead of the expected JSON object. #1600

@knight-kd

Description

@knight-kd

Description

When I call the abort API to cancel an ongoing payment in the test environment, an error occurs: the Adyen API returns a string instead of the expected JSON object. However, the JSON conversion is handled within the SDK of com.adyen:adyen-java-api-library:29.0.0. This issue has not been observed in the production environment; it only started occurring in the test environment on November 19th and is 100% reproducible. Additionally, I cannot find any logs related to the abort operation in the balance-platform.

Steps to reproduce

  1. Call the /payments API to make a payment
  2. Before the payment is completed, call the /abort API to cancel the payment.

Actual behavior

abort error: type=JsonSyntaxException, message=java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 2 path $
See https://github.com/google/gson/blob/main/Troubleshooting.md#unexpected-json-structure

Expected behavior

The Adyen abort API should return a 200 status with the correct response payload.

Code snippet or screenshots (if applicable)

private suspend fun abortPayment(payment: OrderingPayment): Either<OrderingError, Unit> = Either.catch {
val abortServiceId = RandomStringUtils.randomAlphanumeric(10)
withTags(payment.logTags()) {
LOG.debug { "Aborting transaction, saleId=${payment.saleId}, abortServiceId=${abortServiceId}, paymentServiceId=${payment.serviceId}, category=${payment.category}" }
}
val abortRequest = TerminalAPIRequestBuilder(payment.saleId, abortServiceId, payment.terminalPoiId).withAbortRequest(
AbortRequest().apply {
abortReason = "MerchantAbort"
messageReference = MessageReference().apply {
messageCategory = payment.messageCategory
saleID = payment.saleId
serviceID = payment.serviceId
poiid = payment.terminalPoiId
}
}
).build()
withContext(Dispatchers.IO) { api.sync(abortRequest) }
Unit.right()
}.getOrElse { e ->
withTags(payment.logTags()) {
LOG.exception(e) { "Error while aborting payment for order: ${payment.idempotencyUuid}" }
}
OrderingError.RemoteError(e).left()
}

Adyen Java API Library version

29.0.0

Java version

21

Operating System

Linux

Additional context

Time of occurrence (approx.): 2025-11-25T09:10:23.346390179Z
Parameter example: saleId=S1F2-000158243353990, serviceId=91h0rgz4y4, category=Payment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug reportIndicates that issue has been marked as a possible bug by its creatordo not stale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions