BillingWebhookKit

Payment webhook contract test generator

Billing routes break when a provider payload shape changes or a refactor silently reads the wrong field. A contract test locks the fields your side effects depend on.

Open the free contract generator

Lock trusted fields after verification

Use a fixture to assert meta.event_name, data.type, data.id, payment status, customer ID, and currency before dispatching billing logic.

Keep idempotency derivation stable

The same fixture should derive the same process-once key every time. That catches route edits that would replay emails, licenses, entitlement writes, or renewal extensions.

Pair contract tests with signature tests

Signature tests prove the raw body is authentic. Contract tests prove your app still understands the authenticated payload shape.

FAQ

What should a payment webhook contract test assert?

It should assert the event name, object type, object ID, status field, customer mapping, currency, and the idempotency key your handler derives before side effects.

Is this different from a signature test?

Yes. A signature test proves the request is authentic. A contract test proves the trusted payload shape still maps to the billing fields your app depends on.

Use the free sample before wiring production checkout

Download a public sample pack with fake Lemon Squeezy fixtures, signature tests, contract checks, duplicate replay tests, and CI skeletons. The Pro Kit preview shows the full paid package structure without exposing the private archive.