Tapsilat Kotlin is a Kotlin client library for accessing the Tapsilat API.
This SDK is implemented to match the feature set in the Go SDK (tapsilat-go) and includes support for order operations, terms, organization currencies, submerchant/suborganization APIs, VPOS management, VPOS-submerchant mappings, and subscription APIs.
This repository uses a single-module layout so feature domains can share one API client and common infrastructure:
shared/: common client, validators, and shared errorsorder/: order domain DTOs and servicescheckout/: checkout service module (placeholder methods included)credit/: credit service module (placeholder methods included)
Service split convention:
SharedApiClient: reusable HTTP transport and error parsingOrderService: order and order-term APIsOrganizationService: organization settings and currenciesSubmerchantService: submerchant/suborganization APIsVposService: VPOS and VPOS-submerchant APIsSubscriptionService: subscription APIsCheckoutService/CreditService: placeholders for upcoming features
Add JitPack repository:
repositories {
mavenCentral()
maven("https://jitpack.io")
}dependencies {
implementation("com.github.tapsilat:tapsilat-kotlin:latest.release")
}Use a Git tag for the version (v1.0.0, v1.1.0, etc.). JitPack builds directly from GitHub tags.
import com.tapsilat.TapsilatApi
fun main() {
// Default endpoint
val api = TapsilatApi.newApi("your_token_here")
// Custom endpoint
val customApi = TapsilatApi.newCustomApi(
endpoint = "https://custom.endpoint.com/api/v1",
token = "your_token_here"
)
// Feature services (recommended)
val orderApi = api.order
val checkoutApi = api.checkout
val creditApi = api.credit
}TapsilatApi still includes backward-compatible facade methods (createOrder, getOrder, etc.) that delegate to these services.
import com.tapsilat.Order
import com.tapsilat.OrderBasketItem
import com.tapsilat.OrderBillingAddress
import com.tapsilat.OrderBuyer
import com.tapsilat.OrderShippingAddress
import com.tapsilat.TapsilatApi
fun main() {
val api = TapsilatApi.newApi("TOKEN")
val order = Order(
locale = "tr",
currency = "TRY",
amount = 5.0,
buyer = OrderBuyer(
id = "123456789",
name = "John",
surname = "Doe",
email = "john@doe.com",
gsmNumber = "5555555555",
identityNumber = "12345678901"
),
shippingAddress = OrderShippingAddress(
address = "Istanbul",
zipCode = "34000",
city = "Istanbul",
country = "Turkiye",
contactName = "John Doe"
),
billingAddress = OrderBillingAddress(
address = "Istanbul",
zipCode = "34000",
city = "Istanbul",
country = "Turkiye",
contactName = "John Doe"
),
basketItems = listOf(
OrderBasketItem(
id = "1",
name = "Product 1",
price = 5.0,
category1 = "Category 1",
category2 = "Category 2",
itemType = "VIRTUAL"
)
)
)
val response = api.createOrder(order)
println("Order ID: ${response.orderId}")
println("Reference ID: ${response.referenceId}")
println("Checkout URL: ${response.checkoutUrl}")
}import com.tapsilat.Validators
fun main() {
val cleanPhone = Validators.validateGsmNumber("+90 555 123-45-67")
println(cleanPhone) // +905551234567
val installments = Validators.validateInstallments("1,2,3,6")
println(installments) // [1, 2, 3, 6]
}createSubmerchant, updateSubmerchant, createVpos, and updateVpos accept currency references in either format:
- currency UUID
- organization currency unit (
TRY,USD,EUR, etc.)
The SDK resolves units to IDs by calling organization currency endpoints and caches currency mappings internally.
For modules planned later, placeholder methods are included now:
CheckoutService.createCheckoutSessionPlaceholder()CreditService.createCreditApplicationPlaceholder()
They currently throw UnsupportedOperationException until feature implementation is added.
createOrdergetOrdergetOrderByConversationIDgetOrdersgetOrderListgetOrderSubmerchantsgetCheckoutUrlgetOrderStatusgetOrderPaymentDetailsgetOrderTransactionscancelOrderrefundOrderrefundAllOrder
getOrderTermcreateOrderTermdeleteOrderTermupdateOrderTermrefundOrderTermorderTerminateorderManualCallbackorderRelatedUpdate
getOrganizationSettingsgetOrganizationCurrencieslistOrganizationCurrencyPresetscreateOrganizationCurrencyresolveCurrencyId
createSubmerchantgetSubmerchantlistSubmerchantsupdateSubmerchantdeleteSubmerchantgetSuborganizationsgetSuborganizationgetSuborganizationDetailgetSuborganizationBySubmerchantgetSubmerchantBySuborganization
listVposlistVposWithFiltercreateVposgetVposupdateVposdeleteVposlistVposAcquirerslistCardSchemeslistVposAcquirerTemplates
listVposSubmerchantscreateVposSubmerchantgetVposSubmerchantupdateVposSubmerchantdeleteVposSubmerchant
getSubscriptioncancelSubscriptioncreateSubscriptionlistSubscriptionsredirectSubscription
The SDK throws:
ApiErrorfor non-2xx API responsesValidationErrorfor local validation failures (phone, installments, currency references)
Example:
try {
api.getOrder("invalid-id")
} catch (e: com.tapsilat.ApiError) {
println("status=${e.statusCode}, message=${e.messageText}")
}./gradlew clean build