Create Order
When an authorization token has been received, ledyer is ready to place the order, now is the best opportunity to double check stock, campaigns etc. before finally creating the order.
- Example Request
- Example Response
curl -X POST \
-H 'authorization: Bearer v4.public.eyJpc3MiOiJs...' \
-H 'content-type: application/json' \
-d '{
"autoCapture": {
"delayMinutes": 10080,
"enabled": true
},
"country": "SE",
"currency": "SEK",
"customer": {
"companyId": "556751-5019",
"email": "bodil.andersson@alfonskritor.com",
"firstName": "Bodil",
"lastName": "Andersson",
"phone": "0700000000",
"reference1": "",
"reference2": "",
"billingAddress": {
"attentionName": "",
"careOf": "",
"city": "Stockholm",
"companyName": "Alfons kritor AB",
"country": "SE",
"postalCode": "11359",
"streetAddress": "Sveavägen 49",
},
"shippingAddress": {
"attentionName": "",
"careOf": "",
"city": "Stockholm",
"companyName": "Alfons kritor AB",
"country": "SE",
"postalCode": "11359",
"streetAddress": "Sveavägen 49",
"contact": {
"email": "",
"firstName": "",
"lastName": "",
"phone": "",
},
},
}
"locale": "sv-SE",
"metadata": {},
"orderLines": [
{
"description": "Coffee Machine X200",
"quantity": 10,
"reference": "111-222-333",
"totalAmount": 500000,
"totalVatAmount": 100000,
"type": "physical",
"unitDiscountAmount": 0,
"unitPrice": 50000,
"vat": 2500
},
{
"description": "Shipping fee",
"quantity": 1,
"reference": "444-555-666",
"totalAmount": 10000,
"totalVatAmount": 2000,
"type": "shippingFee",
"unitDiscountAmount": 0,
"unitPrice": 10000,
"vat": 2500
}
],
"reference": "",
"storeId": null,
"totalOrderAmount": 510000,
"totalOrderAmountExclVat": 408000,
"totalOrderVatAmount": 102000
}'
https://api.sandbox.ledyer.com/v1/authorization-tokens/:token/order
Path parameters
token
The token that was obtained when the authorization was created.
Request body
autoCapture
objectOptionalAn object consisting of the properties delayMinutes
and enabled
,
delayMinutes
must be a number between 0 and 10080 (7 days), enabled
is a boolean.
Example: { "delayMinutes": 10080, "enabled": true }
.
country
stringCountry code such as SE
, FI
etc (ISO 3166-1 alpha-2).
currency
stringExample SEK
, NOK
(ISO 4217 alpha).
customer
objectOptionalAll customer information.
locale
stringSpecify language for the payments application, sv-SE
, da-DK
etc (BCP 47).
metadata
objectOptionalMerchant may send a key/value object literal for internal use.
Example: { "property1": "value1", "property2": "value2" }
.
orderLines
array of orderlinesOptionalAn array of order lines.
reference
stringOptionalThis property can be used for merchant order reference and will be visible on the invoice. Maximum of 50 characters.
source
stringOptionalA string that should either be pos
or online
.
storeId
stringOptionalOnly needed in case of multiple stores with same country and currency.
totalOrderAmount
integerTotal order amount in minor units.
totalOrderAmountExclVat
integerTotal order amount excl. VAT in minor units.
totalOrderVatAmount
integerTotal order VAT amount in minor units.
{
"orderId": "or_1xDXf4JI3PJsGeVAvLE3hHqYS09"
}