Create the Smart Transaction

We create a Smart Transaction the same way we did it in our Getting started example. There is only one difference — the secuard used now belongs to another card program. (Or more precisely, the Merchant Card belongs to another Card Group.)

The program in our example is configured to grant a bonus of 10 % to be spent at a later buy. It will consider only the articles eligible for bonification.

Firstly we call the endpoint to create the Smart Transaction:

Request
POST /api/v2/Smart/Transactions HTTP/1.1
Host: connect-testing.secupay-ag.de
Authenticate: Bearer qb56tjj1bcvo9n2nj4u38k84lo
Content-Type: application/json
Accept: application/json
 
{
"is_demo": true,
"contract": {
"id": "GCR_9OIH9JOL8KIV5PFJBEOS2NN8TCM1DF"
},
    "idents": [
{
"type": "card",
"value": "9276004424644352"
}
],
"basket": {
"products": [
{
"id": 1,
"articleNumber": 30037,
"desc": "Sandwich Romano",
"quantity": 1,
"priceOne": 349,
"tax": 7
},
{
"id": 2,
"articleNumber": 30200,
"desc": "Fruit salad, small bowl",
"quantity": 1,
"priceOne": 249,
"tax": 7
},
{
"id": 3,
"articleNumber": 51,
"ean": "4999012345678",
"desc": "Water, mildly sprinkling, 0.25 ltr.",
"quantity": 2,
"priceOne": 99,
"tax": 19
}
]
},
"basket_info": {
"sum": 796,
"currency": "EUR"
}
}

This creates a Smart Transaction with an amount to pay of €7.96. The gross unit prices of the articles are €3.49, €2.49, and €0.99.

Monetary amounts are expressed in the smallest currency unit (e. g. Euro Cent). This is true for the articles as much as for the card details in the response.

The Smart Transaction has already added the loyalty card in the idents array.

Successful response:

Response
HTTP/1.1 200 OK
Content-Type: application/json
...
 
{
"object": "smart.transactions",
"id": "STX_2DH4N2AFK2NRDH3KQU52ZC89GWMRA2",
"merchant": {
"object": "general.merchants",
"id": "MRC_G8SE48FRHVITKILAPNCEDU0NUD55W8",
"companyname": "Secupay Test-Shop"
},
"contract": {
"object": "general.contracts",
"id": "GCR_9OIH9JOL8KIV5PFJBEOS2NN8TCM1DF"
},
"transactions": [],
"created": "2020-09-25T08:06:32+02:00",
"status": "created",
"transactionRef": null,
"merchantRef": null,
"intent": "sale",
"basket": {
"products": [
{
"id": 1,
"parent": null,
"articleNumber": "30037",
"ean": "",
"desc": "Sandwich Romano",
"quantity": 1,
"priceOne": 349,
"tax": 7,
"group": [],
"serialNumber": null,
"item_type": "article",
"reference_id": null,
"contract_id": null,
"sum": null
},
{
"id": 2,
"parent": null,
"articleNumber": "30200",
"ean": "",
"desc": "Fruit salad, small bowl",
"quantity": 1,
"priceOne": 249,
"tax": 7,
"group": [],
"serialNumber": null,
"item_type": "article",
"reference_id": null,
"contract_id": null,
"sum": null
},
{
"id": 3,
"parent": null,
"articleNumber": "51",
"ean": "4999012345678",
"desc": "Water, mildly sprinkling, 0.25 ltr.",
"quantity": 2,
"priceOne": 99,
"tax": 19,
"group": [],
"serialNumber": null,
"item_type": "article",
"reference_id": null,
"contract_id": null,
"sum": null
}
],
"texts": [],
"type": "default"
},
"basket_info": {
"sum": 796,
"gratuity": null,
"currency": "EUR"
},
"idents": [
{
"object": "smart.idents",
"id": "smi_1",
"prefix": "9276",
"name": "secucard Kundenkarte",
"type": "card",
"value": "9276004424644352",
"valid": true,
"merchantcard": {
"object": "loyalty.merchantcards",
"id": "MCD_2UXQJ84A62MENH7UWH6QXDYJSBNAA9",
"merchant": {
"object": "general.merchants",
"id": "MRC_G8SE48FRHVITKILAPNCEDU0NUD55W8"
},
"created_for_merchant": {
"object": "general.merchants",
"id": "MRC_F40KSJYW5AAJHHC93TQ6C7A8X76WO6"
},
"card": {
"object": "loyalty.cards",
"id": "CRD_22H4H5D47Q44URN2K8KTP876H6M3PM",
"cardnumber": "9276004424644352",
"created": "2015-02-20T08:51:46+01:00"
},
"cardgroup": {
"object": "loyalty.cardgroups",
"id": "CRG_GO7GQ6DHW3TJYGDF64WD16PUIDHQ8Y",
"display_name": "Stammkunde",
"display_name_raw": "Stammkunde",
"stock_warn_limit": 0,
"picture": "https://connect.secucard.com/ds_g/8e79737df1e2513db48908b342c3cc436edf501a"
},
"created_for_store": {
"object": "general.stores",
"id": "STO_3522R8MS2MSHCN7D37UVJYR4P6C4PX"
},
"is_base_card": false,
"points": 0,
"cash_balance": 200,
"bonus_balance": 20,
"balance": 220,
"last_usage": "2017-10-11T09:34:42+02:00",
"last_charge": "2017-10-11T09:34:42+02:00",
"stock_status": "inactive",
"lock_status": "unlocked",
"passcode": 0,
"expiry_date": null
}
}
],
"is_demo": true,
// ...
}

In the card details you see a special card group. There is both, a bonus balance of €0.20, and cash balance €2.00.

The card would already be able to collect bonus balance for this buy. But it would not be used to spend any cash or bonus balance so far.