transaksikita-sdk — Python SDK
SDK backend Python >=3.10, tanpa dependency runtime. Source versi 1.1.0; pembaruan source tidak berarti versi ini sudah diterbitkan ke PyPI.
Instalasi
pip install transaksikita-sdk
import os
from transaksikita import TransaksiKita, CreatePaymentParams
tk = TransaksiKita(
project_id=os.environ["TK_PROJECT_ID"],
public_key=os.environ["TK_PUBLIC_KEY"],
secret_key=os.environ["TK_SECRET_KEY"],
# Default https://api.transaksikita.com
timeout=30, # seconds, NOT milliseconds
max_retries=1,
)
params = CreatePaymentParams(
amount=10000,
customer_name="Budi",
customer_email="budi@example.com",
customer_phone="081234567890",
reference_id="ORDER-1001",
idempotency_key="ORDER-1001", # stable for the same order/retry
expired_minutes=60,
)
# Choose one example per order:
payment = tk.create_payment(params) # customer chooses method in checkout
# payment = tk.create_qris(params)
# payment = tk.create_virtual_account("BRI", params)
# payment = tk.create_ewallet("DANA", params)
print(payment.payment_id, payment.checkout_full_url)
# https://payment-link.transaksikita.com/pay/<paymentId>
Nama distribusi PyPI adalah transaksikita-sdk, tetapi modul import tetap
transaksikita. Paket ini terpisah dari distribusi lama bernama transaksikita.
Jangan memasang keduanya dalam environment yang sama karena modulnya bertabrakan.
Jika memakai paket lama, jalankan python -m pip uninstall transaksikita, lalu
python -m pip install transaksikita-sdk pada environment aplikasi Anda.
Secret key hanya untuk backend, bukan browser/mobile. Key sandbox/production
harus sesuai mode proyek. Helper metode mengisi paymentMethod pada endpoint
publik POST /v1/payments yang sama; bukan API membuat objek Payment Link
multiple-use atau route private dashboard. Helper tidak mengubah object params.
Parameter dan respons
| Parameter | Keterangan |
|---|---|
amount |
Integer rupiah >=500; batas kanal provider bisa lebih ketat |
customer_name |
Nama asli pelanggan; kanal tertentu mewajibkannya |
customer_email / customer_phone |
Diteruskan ke API; OVO memerlukan HP |
payment_method |
QRIS, VA_<BANK>, EWALLET_<VENDOR>, kosong/None |
expired_minutes |
Integer 5–1440, default server 60 |
reference_id |
ID order, tidak otomatis menjadi idempotency key |
idempotency_key |
Header X-Idempotency-Key, unik dan stabil per order |
VA: BCA, BNI, BRI, MANDIRI, PERMATA, CIMB, BSI, MAYBANK, MUAMALAT, BNC, OCBC, DANAMON. Money-in wallet: DANA, OVO, SHOPEEPAY, LINKAJA. Ketersediaan akhir tetap ditentukan provider, bukan daftar vendor payout.
API JSON camelCase dipetakan ke dataclass snake_case: checkout_full_url,
qris_payload, va_number, va_bank, provider_fee, net_amount.
Biaya/net yang belum diketahui None, bukan nol. Buka checkout_full_url,
bukan checkout_url relatif pada domain API.
Status, list, cancel
info = tk.ping()
status = tk.check_status("PAY_123")
if status.status == "success":
print(status.paid_amount, status.paid_at)
result = tk.list_payments(page=1, limit=20, status="success")
print(result.data, result.pagination.total_pages)
# Only pending payments can be cancelled:
# cancelled = tk.cancel_payment("PAY_123")
# final = tk.wait_for_payment("PAY_123", interval=5, max_attempts=60)
Status aktual: pending, success, expired, cancelled, failed.
paid hanya tipe kompatibilitas lama; bukan nilai sukses kanonik API.
Webhook Flask
from flask import Flask, request
app = Flask(__name__)
@app.post("/callback")
def callback():
raw = request.get_data(cache=True)
signature = request.headers.get("X-Callback-Signature", "")
if not tk.verify_callback_signature(raw, signature):
return {"error": "Invalid signature"}, 401
payload = request.get_json()
if (payload.get("event") != "payment.status.updated"
or payload.get("projectId") != os.environ["TK_PROJECT_ID"]):
return {"error": "Invalid event/project"}, 400
# Match paymentId/referenceId/amount against YOUR order and update idempotently.
# if payload["status"] == "success": mark_order_paid_once(...)
return {"received": True}, 200
Signature = HMAC-SHA256 atas raw bytes memakai secret key proyek.
Jangan menghitung signature dari JSON yang diserialisasi ulang.
verify_callback(payload) dapat recheck ke API tetapi bukan pengganti
signature. Payload aktual: event, paymentId, projectId, referenceId,
status, amount, paidAmount, paidAt, timestamp. Field legacy tambahan
pada CallbackPayload bersifat opsional untuk kompatibilitas.
Error, retry dan domain
from transaksikita import TransaksiKitaError
try:
tk.check_status("PAY_123")
except TransaksiKitaError as error:
print(error.status_code, error.is_auth_error(), error.is_rate_limited())
- Retry default 0, max 3. GET dapat retry network/5xx/429.
- Create hanya retry jika ada idempotency_key stabil; cancel tidak retry.
- Timeout bukan bukti pembayaran gagal; simpan ID/reference dan rekonsiliasi.
- HTTP redirect ditolak: key tidak diteruskan ke origin lain.
- Default origin
https://api.transaksikita.com+/v1/.... Untuk legacy:base_url="https://transaksikita.com/api"; prefix /api dipertahankan. timeoutdalam detik, berbeda dari SDK Node.js yang memakai milidetik.- Flask/FastAPI opsional dan tidak menjadi dependency SDK. Client ini sinkron; panggil di threadpool saat memakai async web framework.
Docs: https://docs.transaksikita.com · Reference: https://docs.transaksikita.com/reference
Build
python -m pip install build twine
python -m build
python -m twine check dist/*
Wheel/sdist berisi package, type marker, dokumentasi dan LICENSE, bukan .env.
Tidak ada upload/publish otomatis. MIT — TransaksiKita.
Metadata
Release files for transaksikita-sdk 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| transaksikita_sdk-1.1.0.tar.gz | 14.7 kB | Without provenance | Details for transaksikita_sdk-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| transaksikita_sdk-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for transaksikita_sdk-1.1.0-py3-none-any.whl |
Total release size: 27.6 kB
Release files / transaksikita_sdk-1.1.0.tar.gz
| Download URL | transaksikita_sdk-1.1.0.tar.gz |
|---|---|
| Size | 14.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7c0321849b0b9dcfb401db814f756d5c04cee7b7f007fee016e272652e42ac2b
|
|
BLAKE2b-256 checksum How to use checksums |
3879e45c15c883bb378d2d68f65089f59ac31b0e0bff7e101d1574ff72f502c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.15.2
|
Release files / transaksikita_sdk-1.1.0-py3-none-any.whl
| Download URL | transaksikita_sdk-1.1.0-py3-none-any.whl |
|---|---|
| Size | 12.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b3bf226508e12c7e941f30b43b7dfc22c06c5cb844fa33e67edc0bbfe39873e1
|
|
BLAKE2b-256 checksum How to use checksums |
dc9e0d76aad5f2e13c89f1cdf91cd4aa89e25d2a0a715c017d487af0c6b2ab28
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.15.2
|
Security for transaksikita-sdk 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.