Skip to content

Paddle Billing Setup & Integration Guide

The paddle provider integrates Paddle Billing (Merchant of Record), Subscriptions, Customer Portal, and One-Time Subscription Charges into the Kirak payments runtime.


Kirak connects to Paddle Billing directly via async REST API calls with httpx. No external Paddle SDK or additional pip package is required.

Terminal window
pip install "kirak"

[!NOTE] Merchant of Record (MoR): Paddle acts as the Merchant of Record, collecting and remitting global sales tax/VAT on your behalf. A completed transaction’s amount reflects the tax-inclusive grand total paid by the customer, and net_amount stores your net payout earnings.


In the Paddle Dashboard (Sandbox or Live):

  1. Navigate to Developer Tools $\rightarrow$ Authentication.
  2. Generate an API key.

In Paddle $\rightarrow$ Checkout $\rightarrow$ Checkout settings:

  1. Set the Default payment link to an approved page on your site that includes Paddle.js.
  2. When Kirak initiates a checkout, it returns your approved URL appended with ?_ptxn=<transaction_id>.
{
"payments": {
"default_provider": "paddle",
"providers": {
"paddle": {
"type": "paddle",
"environment": "sandbox",
"default_tax_category": "standard"
}
}
}
}
Setting Type Default Description
environment string "sandbox" "sandbox" or "production"
default_tax_category string "standard" Tax category used when auto-creating items without a catalog price_id
checkout_url string null Optional approved URL override for Paddle.js checkout
Terminal window
KIRAK_PAYMENT_PADDLE_API_KEY=...
KIRAK_PAYMENT_PADDLE_WEBHOOK_SECRET=... # Obtained in Step 3

In the Paddle Dashboard $\rightarrow$ Developer Tools $\rightarrow$ Notifications $\rightarrow$ New destination:

  1. URL: https://your-domain.com/payments/webhook/paddle
  2. Subscribe to Events:
    • Transactions: transaction.completed, transaction.canceled, transaction.payment_failed
    • Adjustments & Refunds: adjustment.created, adjustment.updated
    • Subscriptions: subscription.created, subscription.activated, subscription.updated, subscription.trialing, subscription.paused, subscription.resumed, subscription.past_due, subscription.canceled
  3. Copy the generated Secret key into KIRAK_PAYMENT_PADDLE_WEBHOOK_SECRET.

[!NOTE] Signature Verification: Paddle signs requests using the Paddle-Signature header (ts=...;h1=...). Kirak verifies the HMAC-SHA256 hash of <ts>:<raw_body> against your configured secret key.


result = await kirak.payments.initiate_payment({
"provider": "paddle",
"user_id": "usr_500",
"amount": 2999, # $29.99
"currency": "USD",
"name": "Desktop Pro",
"type": "one_time",
"price_id": "pri_01gsz8x8sawmvhz1pv30nge1ke", # Paddle Catalog Price ID
})
checkout_url = result["data"]["url"]
result = await kirak.payments.initiate_payment({
"provider": "paddle",
"user_id": "usr_500",
"amount": 0, # Price defined by catalog price_id
"currency": "USD",
"name": "SaaS Starter Plan",
"type": "subscription",
"price_id": "pri_01h8abcdefghijk1234567890",
})

Paddle provides a self-service customer portal where users can update payment cards or cancel their subscription:

portal = await kirak.payments.get_billing_portal({
"user_id": "usr_500",
"provider": "paddle",
})
portal_url = portal["data"]["portal_url"]

4.4 One-Time Charges on Existing Subscriptions

Section titled “4.4 One-Time Charges on Existing Subscriptions”

Paddle does not keep standalone vaulted card tokens in Kirak. Instead, off-session charges are executed against an active subscription:

result = await kirak.payments.charge_off_session({
"provider": "paddle",
"user_id": "usr_500",
"amount": 1500, # $15.00
"currency": "USD",
"name": "API Extra Usage",
"subscription_id": "sub_01h8subxxxxxxxxxxxxxxxxx",
"idempotency_key": "paddle-overage-usr500-oct",
})

Normalized event Gateway Events Description
payment_completed transaction.completed Transaction paid and finalized
payment_failed transaction.payment_failed Payment failed
subscription_renewed transaction.completed (for recurring subscription cycle) Cycle billed
subscription_updated subscription.updated, subscription.resumed Subscription modified
subscription_past_due subscription.past_due Renewal charge failed
subscription_cancelled subscription.canceled Subscription terminated
refund_completed adjustment.created, adjustment.updated (action="refund") Refund issued
dispute_created adjustment.created (action="chargeback") Chargeback opened