Step 2: Create the Smart Transaction

Firstly, we need to create a Smart Transaction with the order details. We use the secuconnect API endpoint POST /api/v2/Smart/Transactions:

Request
POST /api/v2/Smart/Transactions HTTP/1.1
Host: connect-testing.secupay-ag.de
Authorization: Bearer qb56tjj1bcvo9n2nj4u38k84lo
Content-Type: application/json
Accept: application/json
 
{
"is_demo": true,
"contract": {
"id": "GCR_2H69XY35227V2VKP9WRA3SJ0W95RP0"
},
"customer": {
"contact": {
"forename": "Lesley",
"surname": "Mustermann",
"phone": "+49 555 5555555",
"mobile": "+49 177 5555555",
"address": {
"street": "Musterstr.",
"street_number": "840",
"additional_address_data": "App. 506",
"postal_code": "09999",
"city": "East Palmaside",
"country": "DE"
},
"email": "Andrew37@example.org",
"dob": "1965-12-31"
}
},
"intent": "sale",
"basket": {
"products": [
{
"item_type": "sub_transaction",
"desc": "Orders for Muster-Elektrogeräte GmbH",
"sum": 5350,
"reference_id": "1002",
"contract_id": "GCR_ZPMJGRH4SU3X0H3Y3WYB69XVXAG8PJ",
"sub_basket": [
{
"id": 1,
"articleNumber": 1,
"desc": "Coffee maker with remote control",
"quantity": 1,
"priceOne": 5000,
"tax": 19
},
{
"id": 1000,
"item_type": "shipping",
"name": "Standard delivery 2-3 days",
"quantity": 1,
"priceOne": 350,
"tax": "19"
},
{
"item_type": "stakeholder_payment",
"desc": "Marketplace fee",
"sum": 161,
"reference_id": "fee",
"contract_id": "GCR_2H69XY35227V2VKP9WRA3SJ0W95RP0"
}
]
}
]
},
"basket_info": {
"sum": 5350,
"currency": "EUR"
},
"payment_context": {
"auto_capture": true
},
"application_context": {
"return_urls": {
"url_push": "https://shop.example.org/PUSH?order=12345"
}
}
}

This creates a Smart Transaction for a coffee maker about €53.50 including shipping cost. The marketplace earns a fee of €1.61.

Monetary amounts are expressed in the smallest currency unit (e. g. Euro Cent).

The auto_capture setting will save the customer an additional call.

Since everthing is fine, the API responds with 200 OK:

Response
HTTP/1.1 200 OK
Content-Type: application/json
...
 
{
"object": "smart.transactions",
"id": "STX_2UYAHWYC32X2GT37V32E8BPRNUA2A3",
"merchant": {
"object": "general.merchants",
"id": "MRC_WVHJQFQ4JNVYNG5B55TYK748ZCHQP8",
"companyname": "Secupay Test-Shop"
},
"contract": {
"object": "general.contracts",
"id": "GCR_2H69XY35227V2VKP9WRA3SJ0W95RP0"
},
"customer": {
"object": "payment.customers",
"id": "PCU_3J7GCMPPE2X2GT37V32E8BPRNUA2AW",
"contact": {
"forename": "Lesley",
"surname": "Mustermann",
"name": "Lesley Mustermann",
          "phone": "+49 555 5555555",
"mobile": "+49 177 5555555",
"address": {
"street": "Musterstr.",
"street_number": "840",
"additional_address_data": "App. 506",
"postal_code": "09999",
"city": "East Palmaside",
"country": "DE"
},
"email": "Andrew37@example.org",
"dob": "1965-12-31T00:00:00+01:00"
}
},
// ...
"created": "2021-03-16T18:20:15+01:00",
"status": "created",
// ...
"intent": "sale",
"basket": {
"products": [{
"item_type": "sub_transaction",
"desc": "Orders for Muster-Elektrogeräte GmbH",
"reference_id": "1002",
"contract_id": "GCR_ZPMJGRH4SU3X0H3Y3WYB69XVXAG8PJ",
"sum": 5350,
"sub_basket": [{
"id": 1,
"parent": null,
"item_type": "article",
"desc": "Coffee maker with remote control",
"articleNumber": "1",
"ean": "",
"quantity": 2,
"priceOne": 5000,
"tax": 19,
"reference_id": null,
"group": []
}, {
"id": 1000,
"parent": null,
"item_type": "shipping",
"desc": "Standard delivery 2-3 days",
"articleNumber": "",
"ean": "",
"quantity": 1,
"priceOne": 350,
"tax": "19",
"reference_id": null,
"group": []
}, {
"item_type": "stakeholder_payment",
"desc": "Marketplace fee",
"reference_id": "fee",
"contract_id": "GCR_2H69XY35227V2VKP9WRA3SJ0W95RP0",
"sum": 161
}]
}],
// ...
},
"basket_info": {
"sum": 5350,
// ...
"currency": "EUR"
},
"is_demo": true,
// ...
"payment_context": {
"auto_capture": true,
// ...
},
"application_context": {
"return_urls": {
"url_push": "https://shop.example.org/PUSH?order=12345"
}
}
}

As you see, our system added some information. Most interesting for you are:

  • the Smart Transaction ID (STX_2UYAHWYC32X2GT37V32E8BPRNUA2A3);

  • the Payment Customer ID (PCU_3J7GCMPPE2X2GT37V32E8BPRNUA2AW);

  • the status (created).

The Smart Transaction ID is needed in the next step.