Skip to main content
Version: Next

Accept your first QR payment in 7 lines of code

Why is it this fast?

The TConnect API requires AES-256-CBC encryption on every request and JWT token management. Instead of handling those parts yourself, use the official SDK — a single file that bundles encryption, login, automatic token refresh, and every endpoint. You just call create_qr(...).

Step 1 — Prepare your credentials​

TConnect provides you with the following (Staging environment):

ItemUsed for
partner_codeMerchant identifier
username / passwordJWT login
client_id / client_secretJWT login
secret_keyAES-256 key (hex string) to encrypt requests
service_code / va / bincodeFrom Get Services — used when creating a QR

Step 2 — Download the SDK (1 file, copy into your project)​

📥 Download tconnect.py · Install dependencies: pip install requests cryptography

Step 3 — Create a QR (7 lines)​

from tconnect import TConnect

tc = TConnect(partner_code="81234567", username="[email protected]", password="Password#123",
client_id="...", client_secret="...", secret_key="<AES_HEX_KEY>",
service_code="vccb-qr", va="VA100023312", bincode="970454")

qr = tc.create_qr(order_id="ORDER123", amount=150000) # auto login + encrypt + call the API
print(qr["image_png_base64"]) # drop into <img src="data:image/png;base64,...">

Step 4 — Receive the payment result (IPN webhook)​

When the customer pays, TConnect calls your webhook with an encrypted payload. The SDK decrypts it in one line:

# Inside your webhook route (Flask/FastAPI/Django...)
event = tc.parse_ipn(request.body) # -> {"order_id": "...", "amount": ..., ...}
# Reconcile event["order_id"] + event["amount"], update the order, return HTTP 200
Always reconcile the amount

Before marking an order as paid, compare the amount in the IPN with the original order amount. Details: IPN Callback.

What else can the SDK do?​

Beyond create_qr and parse_ipn, the SDK wraps every endpoint:

TaskPython / Node / PHP / Java
List servicesget_services() / getServices()
Create a Virtual Account (VA)create_va() / createVa()
Push payment to a POS (card) / Soundboxpush_to_device() / pushToDevice()
Create / cancel an Ecom payment linkcreate_payment_link() · cancel_payment_link() / createPaymentLink() · cancelPaymentLink()
Get QR transactionsget_qr_transactions() / getQrTransactions()
Look up by Order IDcheck_qr_order() / checkQrOrder()
Card / cash transactionsget_card_transactions() · get_cash_transactions()

Next steps​

note

The SDK here is a single-file reference implementation for fast integration. You can adapt it to your project. Official packages (pip / npm / composer) will be released later.