Payment received → ledger row
The moment a payment succeeds, it is written as a row in the ledger sheet — amount, currency, customer, and invoice — assembled mechanically from the payment event itself, so the books are never waiting on someone to type it in.
- paymentId
- pay_881
- amountCents
- 800
- currency
- usd
- customerEmail
- client@example.com
- invoiceId
- inv_104
- paidAt
- 2026-11-09T22:00:00Z
Sample result: Ledger row written for payment pay_881.
What each step does
Step 1 · Shape the note
The wording of the note is shaped from the fields picked below.
Step 2 · Write it back
The outcome is posted back through the connection you name. The secret stays sealed; the step carries the name only.
Step 3 · Send it onward
Step 4 · The result
This is what the run hands back, written into the run's record where you can read it.
What you'll fill in
These are the only things the template asks of you. Examples teach the shape — they are never values your flow runs on; what you type (or the stated starting value) is what gets used.
| Field | What to put in it | Example |
|---|---|---|
| Ledger sheet | The connection, by name, that can append rows to the ledger sheet. | A connection you name — never a key pasted here |
Set it up
- Fill in the fields below.
- Name the connections it needs — by name only.
- Look at the trigger preview: what would start a run, counted before anything is armed.
- Review the steps, the rules, and every place a person is asked.
- Create it — then run it once yourself, and read the run's record.
Use this template
The definition
The whole mechanism, before you take it. Package checksums: sha256:de57cd96437d… · sha256:bacd419eab2e… · sha256:f6da176bc05b…. A flow made from this template carries this template's name and version in its record, and exports in the standard bundle with that provenance.
Advanced · the three files, as written
{
"trigger.json": {
"template": {
"slug": "payment-received-ledger-row",
"version": 1,
"name": "Payment received → ledger row",
"category": "money-expenses",
"outcome": "The moment a payment succeeds, it is written as a row in the ledger sheet — amount, currency, customer, and invoice — assembled mechanically from the payment event itself, so the books are never waiting on someone to type it in.",
"outputName": "Ledger row result",
"fits_when": [
"online_payments"
],
"needs": [
"connection:sheet"
]
},
"trigger": {
"type": "stripe.payment.succeeded",
"source": "stripe",
"manifestFields": {
"paymentId": "string!",
"amountCents": "int!",
"currency": "string!",
"customerEmail": "string",
"invoiceId": "string",
"paidAt": "iso!"
}
},
"inputConvention": "envelope",
"variables": [
{
"name": "sheetConnection",
"kind": "connection",
"label": "Ledger sheet",
"instruction": "The connection, by name, that can append rows to the ledger sheet."
}
],
"sample": {
"input": {
"paymentId": "pay_881",
"amountCents": 800,
"currency": "usd",
"customerEmail": "client@example.com",
"invoiceId": "inv_104",
"paidAt": "2026-11-09T22:00:00Z"
},
"output": "Ledger row written for payment pay_881."
}
},
"flow.json": {
"name": "Payment received → ledger row",
"inputConvention": "envelope",
"clefIn": [
{
"ruleset": "payment-ledger-guard",
"ids": [
"payment-has-amount"
]
}
],
"steps": [
{
"type": "transform",
"template": {
"segments": [
{
"text": "Payment "
},
{
"field": {
"source": "trigger",
"name": "paymentId",
"label": "Payment · ID"
}
},
{
"text": ": "
},
{
"field": {
"source": "trigger",
"name": "amountCents",
"label": "Payment · Amount (cents)"
}
},
{
"text": " "
},
{
"field": {
"source": "trigger",
"name": "currency",
"label": "Payment · Currency"
}
},
{
"text": " from "
},
{
"field": {
"source": "trigger",
"name": "customerEmail",
"label": "Payment · Customer"
}
},
{
"text": ", invoice "
},
{
"field": {
"source": "trigger",
"name": "invoiceId",
"label": "Payment · Invoice"
}
},
{
"text": "."
}
]
}
},
{
"type": "http",
"method": "POST",
"connectionFromVariable": "sheetConnection",
"url": "https://sheets.example.com/rows",
"body": {
"segments": [
{
"text": "{\"paymentId\": \""
},
{
"field": {
"source": "trigger",
"name": "paymentId",
"label": "Payment · ID"
}
},
{
"text": "\", \"amountCents\": "
},
{
"field": {
"source": "trigger",
"name": "amountCents",
"label": "Payment · Amount (cents)"
}
},
{
"text": ", \"currency\": \""
},
{
"field": {
"source": "trigger",
"name": "currency",
"label": "Payment · Currency"
}
},
{
"text": "\", \"customerEmail\": \""
},
{
"field": {
"source": "trigger",
"name": "customerEmail",
"label": "Payment · Customer"
}
},
{
"text": "\", \"invoiceId\": \""
},
{
"field": {
"source": "trigger",
"name": "invoiceId",
"label": "Payment · Invoice"
}
},
{
"text": "\", \"paidAt\": \""
},
{
"field": {
"source": "trigger",
"name": "paidAt",
"label": "Payment · Paid at"
}
},
{
"text": "\"}"
}
]
}
},
{
"type": "dispatch",
"channel": "event",
"name": "finance.payment.logged"
},
{
"type": "output",
"value": {
"segments": [
{
"text": "Ledger row written for payment "
},
{
"field": {
"source": "trigger",
"name": "paymentId",
"label": "Payment · ID"
}
},
{
"text": "."
}
]
}
}
]
},
"rules.json": {
"rulesets": [
{
"name": "payment-ledger-guard",
"version": 1,
"rules": [
{
"id": "payment-has-amount",
"on": "step.payload.amountCents",
"op": "missing",
"action": "block",
"msg": "A payment event without an amount cannot be entered in the ledger."
}
]
}
],
"permissions": {
"approvals": {
"approveBeforeSteps": [],
"rejectRequiresComment": true,
"dueSeconds": 259200,
"onExpire": "continue"
},
"connections": {
"required": [
{
"nameFromVariable": "sheetConnection",
"usedBySteps": [
1
]
}
],
"optional": []
}
}
}
}