Transactions
A transaction is an authorized payment, always for the whole amount. You capture it to take the money, refund what you captured, or void it to release the authorization. Seq returns it, as a whole object, whenever it changes.
Requests
| Request | What it does |
|---|---|
POST {shopid}:trn:{trnid}/capture |
Capture some or all of what is left of the authorization. |
POST {shopid}:trn:{trnid}/refund |
Refund some or all of what was captured. |
POST {shopid}:trn:{trnid}/void |
Void the authorization, before any capture. |
A transaction comes into being in one of three ways, and seq returns
it in each: a payer pays a payment link, which makes
a "transaction"; a payer pays the first charge of a
subscriber link as they save their
card, which makes a "charge"; or you
charge a subscriber, which makes a "charge"
and answers with its "id". Either way, its "id" is the {trnid}
of the requests above.
The transaction object
Every field below is always there, but where its row says otherwise.
A field without a value is an empty string, an empty array, or, for
"locked", null; a client must skip fields it doesn't know, as
Compatibility says.
| Field | Type | Description |
|---|---|---|
type |
string | "transaction", or "charge" for a charge of a subscriber. |
id |
integer | The transaction's ID, the {trnid} of its requests. A shop's transactions are numbered from 1. |
rev |
integer | The revision: 1 when the transaction is created, and one higher with each change. Of two copies of a transaction, the one with the higher "rev" is the newer. |
locked |
string or null | The ID of the API key that locked the transaction in the dashboard, as "u7812#4", or null. A locked transaction refuses captures, refunds, and voids until it is unlocked. |
method.type |
string | How the payer paid: "card", "applepay", or "mobilepay". |
method.id |
string | An opaque ID of the card or device, the same for each payment with it in your shop. Use it to recognize a returning card, as for fraud checks; you can't charge it. |
method.card |
object | The card, which every payment has today, as Apple Pay and MobilePay pay with one. A later method may have none, so check that it is there. |
method.card.brand |
string | The card's brand: "visa", "mastercard", "maestro", "dankort", "visadankort", "forbrugsforening", "amex", "diners", "discover", "jcb", or "unionpay". See the knowledge base's Payment methods. |
method.card.last4 |
string | The last four digits of the card number. |
services |
array of strings | What took part in the payment: "3dsecurev2", "applepay", and "mobilepay", or on older transactions "3dsecure" and "dsbn"; and the acquiring agreement, such as "clearhaus-3" or "nets-1", by the name the dashboard gives it. |
info.ip |
string | The IP address, v4 or v6, of the browser that paid. |
info.ndisplay |
integer | How many times the payment window was shown before the payment succeeded. Not in a charge. |
info.nfail |
integer | How many payments were declined before it. Not in a charge. |
time.created |
integer | When the payment link was created, in Unix time: seconds since 1970-01-01 UTC. |
time.authorized |
integer | When the payment was authorized, in Unix time. |
orderid |
string | Your order ID, from the payment link or the charge. |
billing |
object | The billing address, from the payment link or the charge: "name", "company", "vatin", "gln", "email", "phone", "address", an array of lines, "city", "zip", "state", and "country", each as it was given, or empty. See Addresses. |
shipping |
object | The shipping address, with the fields of "billing" but "vatin" and "gln". |
items |
array of objects | The items, from the payment link or the charge, each with "name", "quantity", "total", and "sku", in the order given. "quantity" is 1 where none was given, and the strings are empty. |
acts |
array of objects | The acts: its captures, refunds, and void, oldest first. |
totals.attempted |
amount | The sum of the items' totals. Always the same as "authorized", as a payment is never partly authorized. |
totals.authorized |
amount | What the issuer authorized: the whole amount. |
totals.captured |
amount | The sum of the captures. |
totals.refunded |
amount | The sum of the refunds. |
totals.voided |
amount | 0, or the whole amount once the transaction is voided. |
totals.left |
amount | What can still be captured: authorized - captured, or 0 once voided. |
A transaction that was paid, captured, and partly refunded:
{
"type": "transaction",
"id": 378,
"rev": 3,
"locked": null,
"method": {
"type": "card",
"id": "WkS3rJht/unginSCpOEwqVtH6SJWt4+StC8TWl+kP6w=",
"card": {
"brand": "visadankort",
"last4": "1234"
}
},
"services": [
"3dsecurev2",
"clearhaus-3"
],
"info": {
"ip": "198.51.100.74",
"ndisplay": 2,
"nfail": 0
},
"time": {
"created": 1727088810,
"authorized": 1727088919
},
"orderid": "00029384",
"billing": {
"name": "Peter Nielsen",
"company": "Nielsen A/S",
"vatin": "DK91738264",
"gln": "7953878173521",
"email": "pn@nielsenas.dk",
"phone": "+45 90014893",
"address": ["Pederstrupvej 14"],
"city": "Teststrup",
"zip": "8320",
"state": "",
"country": "DK"
},
"shipping": {
"name": "Peter Nielsen",
"company": "Nielsen A/S",
"email": "pn@nielsenas.dk",
"phone": "+45 90014893",
"address": ["C/O Peter Nielsen", "Pederstrupvej 14"],
"city": "Teststrup",
"zip": "8320",
"state": "",
"country": "DK"
},
"items": [
{
"quantity": 2,
"total": "199.90 DKK",
"name": "Danmarkskort plakat",
"sku": "182932000-MAP-DK"
},
{
"quantity": 1,
"total": "45 DKK",
"name": "Fragt - PostNord",
"sku": ""
}
],
"acts": [
{
"act": "capture",
"time": 1727109740,
"who": "s1286#1",
"total": "244.90 DKK",
"history": [
{"item": 0, "quantity": 2, "total": "199.90 DKK"},
{"item": 1, "quantity": 1, "total": "45 DKK"}
]
},
{
"act": "refund",
"time": 1727196369,
"who": "u7812#3",
"total": "99.95 DKK",
"history": [
{"item": 0, "quantity": 1, "total": "99.95 DKK"}
]
}
],
"totals": {
"attempted": "244.90 DKK",
"authorized": "244.90 DKK",
"captured": "244.90 DKK",
"refunded": "99.95 DKK",
"voided": "0 DKK",
"left": "0 DKK"
}
}
Acts
A capture, a refund, or a void is an act. Each one that succeeds is
added to "acts", and raises "rev" by one:
| Field | Type | Description |
|---|---|---|
act |
string | "capture", "refund", or "void". |
time |
integer | When it was done, in Unix time. |
who |
string | The ID of the API key that did it, such as "s1286#1" for a request of yours, or "u7812#3" for a user in the dashboard. See API keys. |
total |
amount | How much it captured, refunded, or voided. |
history |
array of objects | What the request that made it gave as its "history", as is, or []. The dashboard records which items it covered, each as {"item": 0, "quantity": 1, "total": "99.95 DKK"}, where "item" indexes "items". We don't check it, so don't rely on it for amounts: "total" is the truth. |
Acts made in the dashboard come through seq like your own, with the
user's key in "who".
Index
The number of acts a transaction has is its index, the length of
"acts". A capture or a refund must send it as "index", which you
know from the transaction as seq last returned it. If an act has been
made since, the index is stale, and the request fails without doing
anything. So two requests made from the same state, as by two of your
servers, or by you and someone in the dashboard, can't both go
through. See Retries and idempotency.
Rules
- Capture any amount up to
"left", as many times as you like."left"goes down by each capture. - Refund any amount up to
captured - refunded, as many times as you like. - Void only a transaction with no acts: it releases the whole authorization, and is then the only act. Once a part is captured, the rest can't be voided, and is released when the authorization runs out.
- A transaction's amounts are all in its items' currency. An act in another currency is refused.
- A locked transaction refuses every act until it is unlocked.
How long an authorization can be captured is not the API's to decide, but the card scheme's and the acquirer's: see the knowledge base's Authorizations.
Charges
A charge of a subscriber is a transaction too, whether you made it with Charge subscriber, or the payer paid it as the first charge of a subscriber link. It differs from a payment link's transaction in this:
- Its
"type"is"charge". - Its
"info"has only"ip", without"ndisplay"and"nfail". - It has a
"subscriber": the subscriber it charged, as below. - Its
"orderid","items", and addresses come from the request that made it: the charge, or the subscriber link. An address that a charge left out is the subscriber's.
| Field | Type | Description |
|---|---|---|
subscriber.id |
integer | The subscriber's ID. |
subscriber.rev |
integer | The subscriber's revision when it was charged. |
subscriber.ref |
string | The subscriber's "ref", as you gave it. |
Seq returns a charge after its subscriber, as What seq guarantees explains, and you capture, refund, and void it as any transaction.