Connect your own Paddle Billing store to KDPika licensing through a verified, durable backend. This does not add a processor to KDPika platform subscriptions.
What you will learn
- Configure native notifications and approved product/plan mappings.
- Issue once after confirmed payment, then handle supported lifecycle changes.
- Deliver a saved key privately and test without exposing buyer/card data.
Prerequisites
- Complete the Sandbox quickstart and store service setup.
- Use your own provider merchant account and private backend credentials; never KDPika's platform billing credentials.
- Have a product-scoped Sandbox management key with licenses:read and licenses:write.
- Configure one eligible quantity-one line. Mixed baskets, multi-seat quantities and partial refunds need an explicitly reviewed policy.
Configure the provider
- Use a Paddle Billing Sandbox account, not Paddle Classic. Create a one-time or recurring price and save its pri_ ID.
- Create a notification destination pointing to your own HTTPS /provider-event endpoint. Select transaction.completed, transaction.payment_failed, subscription.updated, subscription.canceled, subscription.past_due, subscription.paused, adjustment.created and adjustment.updated.
- Save that destination's secret as KDP_STORE_WEBHOOK_SECRET and a private Sandbox API key as KDP_STORE_API_KEY. Its permissions must allow reading transactions, customers, subscriptions and adjustments.
- Set provider/source to paddle, environment to sandbox and seller_id to your own stable nonpersonal merchant reference. The API key and destination must belong to that same account; do not accept a merchant ID supplied by a buyer.
- Map each pri_ ID in offer_map. Confirm it is the single quantity-one price in your checkout.
Verify before granting access
Paddle-Signature uses ts, a colon and the exact raw body, HMAC-SHA256 and h1 values. This reference follows a five-second clock tolerance, so accurate server time and immediate ingress verification matter. API reads use sandbox-api.paddle.com in Sandbox and api.paddle.com in Live. Account ownership is the scoped API key/destination pair, not an invented livemode field.
Provider verification, receipt and fulfillment are separate. HTTP 202 only means the authenticated notification was saved. A buyer redirect or successful browser message never creates a license. Only the backend worker can authorize the scoped licensing write after current provider reads.
Event and lifecycle mapping
| Notification | Confirmed evidence | Licensing decision |
|---|---|---|
| transaction.completed | Current completed transaction, no approved adjustment, one price, verified customer; subscription active when present | Issue for initial api/web origin; subscription_recurring renews an existing mapping once by transaction ID. |
| transaction.payment_failed | Current transaction is not completed and has an existing subscription mapping | Suspend; a recovered completed transaction is not suspended by the old failure. |
| subscription.updated / subscription.canceled / subscription.past_due / subscription.paused | Read current subscription state/scheduled_change | Record cancel intent without losing paid time; suspend current past_due/paused state. |
| adjustment.created / adjustment.updated | Current approved adjustment belongs to the mapped transaction | Full refund revokes; chargeback/warning suspends; confirmed reverse restores. Partial/unknown adjustments require review. |
Only the initial api/web purchase may create a mapping. A renewal arriving without its initial purchase is held. Subscription changes, prorated amounts and mixed baskets are not automatically converted into another license plan. The reference queries approved adjustments before granting a transaction again; duplicate notifications do not add another renewal.
Server examples and deployment
The PHP application contains the native verification, provider API reads, durable ledger and licensing worker. Optional Node/Python examples are complete raw-body ingress servers with an explicit PHP service dependency, not independent native payment workers. The PHP shared-hosting path needs neither Node nor a long-running process.
- Download all exact sources and check the SHA-256 manifest.
- Follow the shared setup without changing the provider/module source or putting private config under a web root.
- Set config.json provider/merchant/mode and offer_map; set fulfillment.json source to the identical provider string and map the approved internal offer to your product plan.
- Run the private work cron, inspect its aggregate states, and then run the separate mail cron. Keep both ledgers/backups persistent.
- Configure SMTP delivery for your own sender. It reuses the encrypted saved key; it never creates another license to resend.
Complete provider module
This exact module is loaded by the shared normalizer. It depends on the complete native authentication and HTTP client and durable service source. It is not a standalone copy/paste webhook endpoint.
<?php
declare(strict_types=1);
// Complete provider module for StoreNormalizer; loaded by normalize.php.
// Requires the shared service/archive, not a standalone payment endpoint.
trait StorePaddleNormalizer
{
private function paddle(array $event): array
{
$type = $event['event_type'] ?? ''; $native = $event['data'] ?? [];
if (str_starts_with($type, 'transaction.')) {
$transaction = $this->get('/transactions/' . $this->ref($native['id'] ?? null))['data'] ?? [];
$order = $transaction['subscription_id'] ?? $transaction['id'] ?? '';
if ($type === 'transaction.payment_failed') {
if (($transaction['status'] ?? '') === 'completed') { return []; }
return [$this->negative((string) $order, (string) $event['event_id'], 'failed')];
}
if ($type !== 'transaction.completed') { return []; }
storeRequire(($transaction['status'] ?? '') === 'completed', 'TRANSACTION_NOT_COMPLETED');
$adjustments = $this->get('/adjustments?transaction_id=' . $this->ref($transaction['id']) . '&status=approved&per_page=1');
storeRequire(($adjustments['data'] ?? null) === [], 'ADJUSTED_PAYMENT_REQUIRES_REVIEW');
$item = $this->one($transaction['items'] ?? []);
$customer = $this->get('/customers/' . $this->ref($transaction['customer_id'] ?? null))['data'] ?? [];
$recurring = is_string($transaction['subscription_id'] ?? null);
storeRequire(in_array($transaction['origin'] ?? '', ['api', 'web', 'subscription_recurring'], true), 'PRORATION_OR_ONE_TIME_SUBSCRIPTION_CHARGE_REQUIRES_REVIEW');
if ($recurring) {
$subscription = $this->get('/subscriptions/' . $this->ref($transaction['subscription_id']))['data'] ?? [];
storeRequire(($subscription['status'] ?? '') === 'active', 'SUBSCRIPTION_NOT_ACTIVE');
}
$initial = ($transaction['origin'] ?? '') !== 'subscription_recurring';
return [$this->paid((string) $order, (string) $transaction['id'], (string) ($item['price']['id'] ?? ''),
(string) ($customer['email'] ?? ''), (string) ($customer['name'] ?? ''), $recurring, [(string) $transaction['id']], null, $initial)];
}
if (str_starts_with($type, 'subscription.')) {
$subscription = $this->get('/subscriptions/' . $this->ref($native['id'] ?? null))['data'] ?? [];
$state = match ($subscription['status'] ?? '') { 'past_due', 'paused' => 'failed', 'canceled' => 'cancelled', default => null };
if ($state === null && ($subscription['scheduled_change']['action'] ?? '') === 'cancel') { $state = 'cancelled'; }
return $state === null ? [] : [$this->negative((string) $subscription['id'], (string) $event['event_id'], $state)];
}
if (str_starts_with($type, 'adjustment.')) {
$adjustment = $this->get('/adjustments/' . $this->ref($native['id'] ?? null))['data'] ?? [];
if (($adjustment['status'] ?? '') !== 'approved') { return []; }
$kind = $adjustment['action'] ?? '';
if (in_array($kind, ['chargeback', 'chargeback_warning', 'chargeback_reverse', 'chargeback_warning_reverse'], true)) {
return [$this->negative((string) ($adjustment['transaction_id'] ?? ''), (string) $event['event_id'], str_ends_with($kind, '_reverse') ? 'recovered' : 'disputed')];
}
storeRequire(($adjustment['action'] ?? '') === 'refund', 'ADJUSTMENT_POLICY_REQUIRES_REVIEW');
$transaction = $this->get('/transactions/' . $this->ref($adjustment['transaction_id'] ?? null))['data'] ?? [];
$total = (string) ($transaction['details']['totals']['total'] ?? '');
storeRequire($total !== '' && (string) ($adjustment['totals']['total'] ?? '') === $total, 'PARTIAL_REFUND_REQUIRES_REVIEW');
return [$this->negative((string) $transaction['id'], (string) $event['event_id'], 'refunded')];
}
return [];
}
}
Test in Sandbox
- Confirm invalid/missing proof cannot issue, and no key or API credential appears in the HTTP reply.
- Complete one permitted Test purchase in your merchant account. Confirm the provider delivery, then run work and verify one DONE issue and a saved encrypted key.
- Deliver to your verified test inbox and activate that key with the same buyer email and Sandbox App ID. Test a mismatched email too.
- Redeliver the same event and overlapping supported paid events. Confirm no second key and no additional renewal days for the same paid receipt.
- For supported subscriptions, test initial payment, another confirmed paid period, current failure/recovery and cancellation. Verify cancellation does not remove already-paid time.
- Test a supported full refund and any exposed dispute lifecycle. Check revoked/suspended state in KDPika; never simulate a refund only by editing the browser return URL.
- Test stale events and a missing initial mapping. Unknown, partial or unsupported cases must be held for review, not silently fulfilled.
Expected result: one authorized initial license, one additive extension per supported new paid receipt, no duplicate grant, no access from an unverified event, and a private delivery record. Renewal adds your mapped integer days, not an exact calendar-period-end update.
Verification boundary
The exact source was executed through local HTTP ingress and explicit synthetic provider-schema API fixtures, with real isolated KDPika Sandbox issuance, activation and supported lifecycle writes. Fixture signatures use local test secrets, not a provider's private signing infrastructure. No real Paddle Billing account purchase is claimed. Your account's permissions, actual delivery format, TLS, provider checkout and email inbox still need the procedure above before Live use. Native WordPress/merchant account execution was unavailable in this documentation environment; this is the explicit contract-test boundary, not recorded-payment evidence.
Go-live checklist
- Review the unsupported boundaries above; do not sell a lifecycle this adapter does not implement.
- Complete your provider account verification and real Test delivery procedure; check merchant, recipient, item and mode.
- Use a separate Live config/state and scoped Live KDPika key; set KDP_CONFIRM_LIVE only after review. Never turn existing Sandbox ledgers into Live by editing their binding.
- Replace provider credentials/destination secret with the matching Live account values. Do not reuse example placeholders.
- Remove every loopback test override, use verified HTTPS and keep credentials and SQLite/encryption backups outside all web roots.
- Monitor private REVIEW/IN_FLIGHT and mail failures. A missing acknowledgement is not proof a write or email did not happen; reconcile before retrying.
- Retain business-effect identities to prevent reissuance. Apply your documented retention, refund, support and key-redelivery policies.
Common mistakes
- Shipping a server management key inside an application or theme.
- Issuing from a redirect, subscription-created event or unverified notification.
- Granting both initial checkout and initial recurring invoice independently.
- Deleting the durable ledger or creating a new effect ID after a timeout.
- Treating a saved key or SMTP acceptance as confirmed inbox delivery.
Official sources
Reviewed for this reference on 18 October 2026. Provider documentation can change independently; check your pinned API and account before upgrading.
Expected result
Only a confirmed provider purchase authorizes a licensing effect. A durable HTTP receipt, completed licensing operation and SMTP acceptance are separate outcomes. Inspect aggregate worker states and verify the resulting license with the same buyer email; no full key appears in public replies.
Security notes
Use least-privilege private provider and product-scoped licensing credentials, verified HTTPS, owner-only persistent state and separate secrets per account/environment. Never trust browser payment claims. Preserve held operations after an unknown result and reconcile before another write; exactly-once behavior across systems is not guaranteed.
Troubleshooting
For a receipt refusal check raw-byte preservation, the matching endpoint secret/account/mode, server clock where applicable and the private bootstrap layout. For REVIEW/IN_FLIGHT inspect provider state, safe private error codes and the licensing ledger before retrying. Missing permissions, recipient data or an initial mapping are not successful payments. For mail verify the separate SMTP ledger and provider delivery evidence. Do not post raw events, keys or SQLite files publicly.
Next steps
Run the selected provider Sandbox procedure, then test private key email delivery. Review supported recipe limitations before enabling Live.