Step 2: Create the Smart Transaction
The API endpoint to create a Smart Transaction is POST https://connect.secucard.com/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
,
"intent"
:
"order"
,
"contract"
: {
"id"
:
"GCR_CNEUVF64H5S8R58R7PB4Q6CNJESBPJ"
},
"basket"
: {
"products"
: [
{
"id"
: 0,
"desc"
:
"ACME ball pen Modern Line 8050"
,
"priceOne"
: 1595,
"tax"
: 19,
"quantity"
: 2
},
{
"id"
: 1,
"desc"
:
"ACME pen case Modern Line"
,
"priceOne"
: 1795,
"tax"
: 19,
"quantity"
: 1
}
]
},
"basket_info"
: {
"sum"
: 4985
},
"application_context"
: {
"return_urls"
: {
"url_success"
:
"https://shop.example.com/PAYMENT-SUCCEEDED"
,
"url_error"
:
"https://shop.example.com/PAYMENT-FAILED"
,
"url_abort"
:
"https://shop.example.com/PAYMENT-ABORTED"
}
}
}
This creates a Smart Transaction with a total amount of €49.85. The gross unit prices of the above articles are €15.95, and €17.95.
Monetary amounts are expressed in the smallest currency unit (e. g. Euro Cent).
If everything is fine, the API responds with 200 OK and the representation of the Smart Transaction:
Response
HTTP/1.1 200 OK
Content-Type: application/json
...
{
"object"
:
"smart.transactions"
,
"id"
:
"STX_2AUSR7M6B2NHPG3C4JTKBEY07YXSAZ"
,
"merchant"
: {
"object"
:
"general.merchants"
,
"id"
:
"MRC_AZS7P6FTNTC6NK0QWFDBREW94ZY2O7"
,
"companyname"
:
"Smart Checkout Testmerchant 8"
},
...
"contract"
: {
"object"
:
"general.contracts"
,
"id"
:
"GCR_CNEUVF64H5S8R58R7PB4Q6CNJESBPJ"
},
...
"created"
:
"2020-02-04T15:34:00+01:00"
,
"status"
:
"created"
,
...
"basket"
: {
"products"
: [
{
"id"
: 0,
"parent"
:
null
,
"articleNumber"
:
null
,
"ean"
:
null
,
"desc"
:
"ACME ball pen Modern Line 8050"
,
"quantity"
: 2,
"priceOne"
: 1595,
"tax"
: 19,
"group"
:
null
,
"serialNumber"
:
null
,
"item_type"
:
"article"
,
"reference_id"
:
null
},
{
"id"
: 1,
"parent"
:
null
,
"articleNumber"
:
null
,
"ean"
:
null
,
"desc"
:
"ACME pen case Modern Line"
,
"quantity"
: 1,
"priceOne"
: 1795,
"tax"
: 19,
"group"
:
null
,
"serialNumber"
:
null
,
"item_type"
:
"article"
,
"reference_id"
:
null
}
],
...
},
"basket_info"
: {
"sum"
: 4985,
"currency"
:
"EUR"
,
...
},
"is_demo"
:
true
,
...
"application_context"
: {
"return_urls"
: {
"url_success"
:
"https://shop.example.com/PAYMENT-SUCCEEDED"
,
"url_error"
:
"https://shop.example.com/PAYMENT-FAILED"
,
"url_abort"
:
"https://shop.example.com/PAYMENT-ABORTED"
}
},
...
"checkout_links"
: {
"url_checkout"
:
"https://checkout.secupay.com?wizardFlow=checkout&stx=STX_2AUSR7M6B2NHPG3C4JTKBEY07YXSAZ&viewMode=fullscreen"
},
...
}
As you see, the secuconnect implementation added a lot of things. Most interesting for you are the ID of the Smart Transaction (line 8), and the checkout URL (line 65).