Skip to main content

How transactions work

Every time you add or remove credits, a transaction is created. Transactions are permanent β€” you always have a complete history of what happened and why.

Credit

Add credits to an account

Debit

Remove credits from an account

Reverse

Undo a previous transaction

Credit β€” add credits

Use this when a customer earns credits, buys a credit pack, or receives a reward.

Parameters


Debit β€” remove credits

Use this when a customer spends credits, uses a feature, or redeems a reward.
Same parameters as credit. The response looks identical, just with "side": "debit" in the entry.
The API prevents negative balances β€” if a debit would bring the balance below zero, it returns an insufficient_balance error. Check the balance first if you want to show your users a friendly message.

Reverse β€” undo a transaction

Made a mistake? Order cancelled? Reverse a transaction to undo it. The original transaction stays in the history β€” a new opposite transaction is created so you always have a complete paper trail.
The response includes "reversal_of": "cct_3mNpK8rW2xY" linking back to the original.
Reversals are idempotent β€” reversing the same transaction twice returns the original reversal.

Viewing history

See every credit and debit on an account, newest first.
Each entry shows:
  • side β€” "credit" (added) or "debit" (removed)
  • amount β€” how many credits
  • transaction_id β€” links back to the transaction (which has the reference and idempotency_key)

Multi-entry transactions β€” move credits between accounts

Credit and debit touch one account at a time. When one business event should move credits between accounts atomically β€” a transfer between two customers, or a bundle that debits a pool and credits several sub-accounts β€” post a single transaction with several entries. Entries must balance: total debits must equal total credits, and a transaction needs at least two entries.
The response is the same transaction object as credit and debit, with one entry per line you posted. Either every entry is written or none is; an unbalanced request returns a 422, and a frozen or closed account anywhere in the entries returns a 409.
Post the balanced pair (or set) that describes the whole event in one call rather than a separate credit and debit β€” a retry or a crash between two calls can leave one side written and the other not.

Working with transactions directly

Every credit, debit, reversal, and multi-entry post is a transaction with an ID (cct_…). You can fetch, reverse, and search them without going through an account.

Retrieve a transaction

Reverse a transaction by ID

Reverses the whole transaction β€” every entry β€” without naming the account. Use this when you hold the transaction ID from an earlier response and the transaction spans several accounts.
The per-account /accounts/{account_id}/reverse endpoint above does the same for a transaction you know by account; both preserve the original and link the reversal through reversal_of.

Find every transaction for a reference

Because you set reference on each write, you can list everything Creem recorded for one event in your system β€” an order, a campaign, a support ticket.

What is an idempotency_key?

An idempotency_key is a unique string you include with every credit or debit request. It’s your safety net against accidental duplicates. Imagine your app credits a customer 500 points for an order. The request goes through, but your app doesn’t get the response back (network hiccup, timeout, server restart). Without protection, retrying would give the customer 1,000 points instead of 500. The idempotency_key prevents this. When you retry with the same key, Creem recognizes it’s the same request and returns the original result β€” no double-crediting.
Use a key that’s tied to the business event, like reward_order_789 or topup_sub_123_2026-04. This way, even if your code accidentally fires twice for the same order, the customer only gets credited once.

How it works


Next steps

Accounts

Create, freeze, and manage accounts.

Recipes

Step-by-step guides for common patterns.

API Reference

Full endpoint schemas.

Introduction

Back to overview.