Create a Smart Transaction with Minimal Data

To create a Smart Transaction we address the POST endpoint for it. This is the minimum data you need to send:

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"
},
"intent": "sale",
"basket_info": {
"currency": "EUR",
"sum": 500
}
}

Let's quickly explain the fields passed:

Field

Type

Meaning

is_demo

boolean

Optional. Productive or demo transaction:

  • true: A demo transaction. The payment is not actually captured.

  • false: A productive transaction.

Defaults to false, productive transaction.

contract

object

The contract. Used to identify the merchant, and sometimes the exact use case.

contract/id

string

The contract ID (GCR_xxx). Needed to identify the contract in our case.

intent

string

A Smart Transaction can have one of two basic operating modes, called intent:

  • order for purchase orders;

  • sale for payment without assuming a contract type.

An order requires an agreement about shipping or collection. The button for the conclosure has a different label (Buy Now! instead of Pay Now!). Incoming orders are found in SecuOffice under Orders » Completed.

Payments can be used for donation, crowd funding, or reservation fees, to name a few examples.

basket_info

object

Only of interest here is the amount to pay.

basket_info/currency

string

Three-letter currency code. Defaults to EUR.

basket_info/sum

int

Amount to pay in the smallest currency unit. For instance 500 in combination with EUR expresses €5.00.

So the merchant wants the payer to conclude a contract that requires a payment of 5 EUR. The only optional field designates it as a demo transaction, so that no money is actually moved.

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 full object representation of the newly created Smart Transaction.

Response
HTTP/1.1 200 OK
Content-Type: application/json
...
 
{
"object": "smart.transactions",
"id": "STX_3K5NPEAFF2NT539D66NNSWC25VNVAZ",
    "merchant": {
"object": "general.merchants",
"id": "MRC_WVHJQFQ4JNVYNG5B55TYK748ZCHQP8",
"companyname": "Secupay Test-Shop"
},
"contract": {
"object": "general.contracts",
"id": "GCR_2H69XY35227V2VKP9WRA3SJ0W95RP0"
},
    // ...
"created": "2020-11-06T10:41:46+01:00",
"status": "created",
// ...
"intent": "sale",
"basket": {
"products": [],
"texts": [],
"type": "default"
},
"basket_info": {
"sum": 500,
"gratuity": null,
"currency": "EUR"
},
"is_demo": true,
// ...
}

As you can see, the API added some details of its own. For instance, the merchant is recognized by the contract. The newly created Smart Transaction begins with the created status.