JVM client implementing kevin. platform API v0.3.
- Java 8+
- Ktor 2.x
Package and installation instructions are available at the Maven Central Repository
<dependency>
<groupId>eu.kevin</groupId>
<artifactId>kevin-jvm</artifactId>
<version>1.0.3</version>
</dependency>
implementation 'eu.kevin:kevin-jvm:1.0.3'
Parameter names and response data match those defined in API documentation.
Detailed API documentation can be found here.
import eu.kevin.api.services.Client
val client = Client(
authorization = Authorization(
clientId = "[YOUR_CLIENT_ID]",
clientSecret = "[YOUR_CLIENT_SECRET]"
)
)
val request = InitiatePaymentRequest(
redirectUrl = "https://yourapp.com/callback",
amount = BigDecimal("12.34"),
currencyCode = "EUR",
description = "My payment",
identifier = UserIdentifier(email = "[email protected]"),
bankPaymentMethod = BankPaymentMethod(
endToEndId = "123",
creditorName = "John Doe",
informationStructured = InformationStructured(
reference = "00220055",
referenceType = "SCOR"
),
requestedExecutionDate = LocalDate.of(2021, 3, 8),
creditorAccount = Account(
iban = "LT144010051005081586"
)
)
)
val response = try {
client.paymentClient.initiatePayment(request)
} catch (e: KevinApiErrorException) {
logger.error(e.responseBody?.error?.description, e)
null
}
import eu.kevin.api.services.Parser
private val parser = Parser()
val webhookRequestBody = """
{
"id": "e4dd60bb-574f-4a13-910a-57c9795d905f",
"bankStatus": "ACSC",
"statusGroup": "completed",
"type": "PAYMENT"
}
""".trimIndent()
val paymentWebhookPayload = parser.parsePaymentWebhookRequest(request = webhookRequestBody)
Email: [email protected]
- MIT license
- Copyright© 2022 kevin.