Kotlin SDK provides API options for integrating Solidgate’s payment orchestrator into your Kotlin applications.
Check our
- Payment guide to understand business value better
- API Reference to find more examples of usage
SDK for Python contains | Table of contents |
---|---|
src/ – main library source code for developmentbuild.gradle.kts – script for managing dependencies and library importsgradle.properties – configuration file for Gradle
|
Requirements Installation Usage Errors |
- Kotlin: 1.4 or later
- Gradle or Maven: as a build tool
- Solidgate account: Public and secret key (request via sales@solidgate.com)
To start using the Kotlin SDK:
-
Add the SDK to your project according to your build tool.
Maven
<repositories> <repository> <id>jitpack.io</id> <url>https://jitpack.io</url> </repository> </repositories> <dependency> <groupId>com.github.Solidgate</groupId> <artifactId>solidgate-sdk</artifactId> <version>1.0.0</version> </dependency>
Gradle
<repositories> <repository> <id>jitpack.io</id> <url>https://jitpack.io</url> </repository> </repositories> <dependency> <groupId>com.github.Solidgate</groupId> <artifactId>solidgate-sdk</artifactId> <version>1.0.0</version> </dependency>
-
Initialize the SDK with your public and secret key.
-
Use test credentials for validation, then transition to production credentials for deployment.
Use the provided Dockerfile for running the SDK locally.
val api = Api(HttpClient(), Credentials("testMerchant", "private0-test-test-test-key123456789"))
val attributes = Attributes(mapOf(
"amount" to 123,
"currency" to "USD",
"customer_email" to "testuser@example.com",
"ip_address" to "8.8.8.8",
"order_description" to "Test subscription",
"order_id" to "order12345",
"platform" to "WEB",
"card_cvv" to "XXX",
"card_exp_month" to 12,
"card_exp_year" to 24,
"card_number" to "4111 11XX XXXX 1111"
))
val response = api.charge(attributes)
Handle errors.
try {
val response = api.charge(attributes)
} catch (e: Exception) {
println(e.message)
}