Omise (Opn Payments) Setup & Integration Guide
The omise provider integrates Omise Links (Credit Cards, PromptPay, TrueMoney, Internet Banking, Konbini), Refunds, and Dispute Read Tracking across Asian and global markets (THB, JPY, SGD, MYR, USD).
1. Prerequisites & Installation
Section titled “1. Prerequisites & Installation”Kirak communicates with Omise directly via async REST API calls with httpx. No external Omise SDK or additional pip package is required.
pip install "kirak"2. Credentials & Configuration
Section titled “2. Credentials & Configuration”Step 1: Obtain Secret Key
Section titled “Step 1: Obtain Secret Key”In the Omise Dashboard:
- Navigate to Keys.
- Copy your Secret key (
skey_test_...in test mode,skey_...in live mode).
Step 2: Configure Webhooks
Section titled “Step 2: Configure Webhooks”In Webhooks:
- Add an endpoint URL:
https://your-domain.com/payments/webhook/omise. - Generate and copy a Webhook secret (base64 string).
Step 3: Configure kirak.json
Section titled “Step 3: Configure kirak.json”{ "payments": { "default_provider": "omise", "providers": { "omise": { "type": "omise", "environment": "test" } } }}[!NOTE] The
environmentsetting ("test"or"live") must match your secret key prefix (skey_test_orskey_). A mismatch raises aCONFIGURATION_ERRORat startup.
Step 4: Set Environment Variables
Section titled “Step 4: Set Environment Variables”KIRAK_PAYMENT_OMISE_SECRET_KEY=skey_test_...KIRAK_PAYMENT_OMISE_WEBHOOK_SECRET=your_base64_secret_from_step23. Usage Examples
Section titled “3. Usage Examples”3.1 One-Time Payment Link
Section titled “3.1 One-Time Payment Link”Amounts are passed in minor units (e.g. satang for THB; 100,000 satang = THB 1,000.00):
result = await kirak.payments.initiate_payment({ "provider": "omise", "user_id": "usr_1100", "amount": 100000, # ฿1,000.00 THB in satang "currency": "THB", "name": "Service Fee", "type": "one_time",})
payment_link_url = result["data"]["url"]3.2 Verification on Return
Section titled “3.2 Verification on Return”Because Omise does not guarantee retries of failed webhook deliveries, always call verify_payment when the customer returns to your success URL:
await kirak.payments.verify_payment({ "provider": "omise", "payment_id": result["data"]["reference"],})4. Feature Limitations
Section titled “4. Feature Limitations”| Feature | Support Status | Notes |
|---|---|---|
| One-Time Payment Links | Supported | Supports Cards, PromptPay, TrueMoney |
| Refunds | Supported | Dispatched via /refunds |
Dispute Read (get_dispute) |
Supported | Reads dispute details from Omise |
Dispute Evidence (submit_dispute_evidence) |
Not Supported | Returns 501 NOT_SUPPORTED; respond in Omise dashboard |
| Subscriptions & Billing Portal | Not Supported | Returns 501 NOT_SUPPORTED |
| Saved Payment Methods | Not Supported | Returns 501 NOT_SUPPORTED |
5. Webhook Event Mapping
Section titled “5. Webhook Event Mapping”Normalized event |
Gateway Events | Description |
|---|---|---|
payment_completed |
charge.complete |
Charge paid successfully |
payment_failed |
charge.failed |
Charge failed or declined |
refund_completed |
refund.create |
Refund created and processed |
dispute_created |
dispute.create |
Dispute opened by bank |
dispute_updated |
dispute.close |
Dispute closed |