Print the Receipt

Example Smart Transaction

After the payment was executed, the Smart Transaction may contain a receipt:

Smart Transaction
{
"object": "smart.transactions",
"id": "STX_2XYYHKXXV2NRCHVSHCS45WSE63PMA2",
// ...
"status": "ok",
// ...
"receipt": [
{
"type": "separator",
"value": {
"caption": "Kundenkarte Aufladung"
}
},
{
"type": "name-value",
"value": {
"name": "Terminal-ID:",
"value": "VT000124",
"decoration": []
}
},
{
"type": "name-value",
"value": {
"name": "Datum:",
"value": "24.09.2020 14:40:58",
"decoration": []
}
},
{
"type": "name-value",
"value": {
"name": "Kartennummer:",
"value": "9276004429942845",
"decoration": []
}
},
{
"type": "name-value",
"value": {
"name": "TA Code:",
"value": "29187305",
"decoration": []
}
},
{
"type": "space"
},
{
"type": "textline",
"value": {
"text": "Zahlung ├╝ber:",
"decoration": []
}
},
{
"type": "textline",
"value": {
"text": "5,00 EUR",
"decoration": [
"important"
]
}
},
{
"type": "space"
},
{
"type": "textline",
"value": {
"text": "Folgender Betrag",
"decoration": []
}
},
{
"type": "textline",
"value": {
"text": "wurde aufgeladen:",
"decoration": []
}
},
{
"type": "textline",
"value": {
"text": "10,00 EUR",
"decoration": [
"important"
]
}
},
{
"type": "space"
},
{
"type": "textline",
"value": {
"text": "Aktuelles Guthaben",
"decoration": []
}
},
{
"type": "textline",
"value": {
"text": "10,00 EUR",
"decoration": [
"important"
]
}
}
],
// ...
}

Here the generated PDF for this receipt:

images/download/thumbnails/97386347/image2020-9-24_14-48-49-version-1-modificationdate-1607008500000-api-v2.png
PDF for similar receipt

There are four types of receipt lines. You can distinguish them by the type field:

  • separators with optional headline;

  • plain textlines;

  • name-value lines;

  • space lines.

Furthermore there are some decorations to emphasise lines, or to align the text at the line.

Separator Line

The separator line starts a new receipt with a caption:

Receipt Line
{
"type": "separator",
"value": {
"caption": "Kundenkarte Aufladung"
}
}

The separator line is like a headline. It needs to be centered, and is printed bolder and larger than normal text. It should be padded with some space at the top and the bottom.

The attribute caption is optional:

Receipt Line
{
"type": "separator",
"value": {
}
}

If there is no caption, you can print a horizontal line instead, or just a number of dashes.

Separator lines have no decorations.

Text Line

A text line, here with decoration important:

Receipt Line
{
"type": "textline",
"value": {
"text": "10,00 EUR",
"decoration": [
"important"
]
}
}

Text lines can have one or more of these decorations:

  • important (print it bold);

  • align-left

  • align-center

  • align-right

The default alignment is to the left.

Name-Value Line

A name-value line, with one text adjusted to the left, the other to the right:

Receipt Line
{
"type": "name-value",
"value": {
"name": "Kartennummer:",
"value": "9276004429942845",
"decoration": []
}
}

Name and value shall be printed at the same line. The name is adjusted to the left, and the value to the right.

Name-value lines can have the decoration important. Here goes the same like for normal text lines. It needs to be printed bolder.

Space Line

This is a space line:

Receipt Line
{
"type": "space"
}

A space line is used to add some vertical space between a series of normal text or name-value lines. It is used to form text sections.

Space lines have neither attributes nor decorations.