Get order
An order session must first be in state authorized
before an order entity is created.
The first event registered on an order is therefore create
, any new events on the order will be supplied in response to subsequent requests for the same order ID,
such as readyForCapture
, authorize
, etc.
Initially, the status
of an order is uncaptured
, as is highlighted in the example response.
Captures, cancels, refunds and edits are handled by unique endpoints, and all separately documented.
Currencies will be formatted according to en_US
in the API responses. Formatting can vary in the checkout though, depending on the configured locale.
- Example Request
- Example Response
curl -X GET \
-H 'authorization: Bearer v4.public.eyJpc3MiOiJs...' \
https://api.sandbox.ledyer.com/v1/orders/:orderId \
Path parameters
orderId
The order ID string that was obtained when the order session was created.
{
"authorizeStatus": "authorized",
"captured": [],
"capturedAmount": {
"amount": "0.00",
"currency": "SEK",
"formatted": "0.00",
"formattedWithCurrency": "SEK 0.00",
"minorUnits": 0
},
"createdAt": "2023-02-14T13:27:15.894811Z",
"customer": {
"billingAddress": {
"attentionName": "Åke anställd",
"careOf": "",
"city": "Solna",
"companyName": "Rocket 4",
"country": "SE",
"postalCode": "999 33",
"streetAddress": "Gatan 99"
},
"companyId": "559311-3714",
"companyName": "Rocket 4",
"email": "jan@example.com",
"firstName": "Jan",
"invoiceChannel": {
"type": "email",
"details": ""
},
"lastName": "Persson",
"paymentMethod": {
"provider": "ledyer",
"type": "invoice"
},
"phone": "+46761010101",
"reference1": "ref1",
"reference2": "ref2",
"shippingAddress": {
"attentionName": "Gunnar Larsson",
"careOf": "",
"city": "Luleå",
"companyName": "Pelles Tak",
"contact": {
"email": "micke.mottagare@email.com",
"firstName": "Micke",
"lastName": "Mottagare",
"phone": "123456789"
},
"country": "Sweden",
"postalCode": "333 33",
"streetAddress": "Sommargatan 33"
},
"vatId": "SE559311371401"
},
"events": [
{
"amount": {
"amount": "0.00",
"currency": "SEK",
"formatted": "0.00",
"formattedWithCurrency": "SEK 0.00",
"minorUnits": 0
},
"createdAt": "2023-02-14T13:27:15.894811Z",
"id": "oe_256Qp2shuTctFUp1aDRa1f2jp5W",
"ledgerId": "in_256Qp7McaZtN8coxjAQW6tETyac",
"orderId": "or_1xE2fDBg9rRwh6nENMA3ly3B3Qg",
"type": "readyForCapture"
},
{
"amount": {
"amount": "5100.00",
"currency": "SEK",
"formatted": "5,100.00",
"formattedWithCurrency": "SEK 5,100.00",
"minorUnits": 510000
},
"createdAt": "2023-02-14T13:27:14.894811Z",
"id": "oe_123Wp2shuTctFUp1aDRa1f2ab6X",
"ledgerId": "in_256Qp7McaZtN8coxjAQW6tETyac",
"orderId": "or_1xE2fDBg9rRwh6nENMA3ly3B3Qg",
"type": "create"
}
],
"expiresAt": "2023-02-28T13:27:15.894811Z",
"id": "or_1xE2fDBg9rRwh6nENMA3ly3B3Qg",
"merchantId": "ac_1xWqkkS5aIbxCJsoseRhSd0OJyD",
"merchantReference": "or_1xE2fDBg9rRwh6nENMA3ly3B3Qg",
"metadata": {
"property1": "value1",
"property2": "value2"
},
"orderAmount": {
"amount": "5100.00",
"currency": "SEK",
"formatted": "5,100.00",
"formattedWithCurrency": "SEK 5,100.00",
"minorUnits": 510000
},
"orderReference": "XP72XUYB",
"paymentMethod": {
"provider": "ledyer",
"type": "invoice"
},
"refunded": [],
"refundedAmount": {
"amount": "0.00",
"currency": "SEK",
"formatted": "0.00",
"formattedWithCurrency": "SEK 0.00",
"minorUnits": 0
},
"riskProfile": {
"tags": []
},
"storeId": "970245072",
"status": ["uncaptured"],
"uncaptured": {
"availableActions": [
{
"type": "cancel"
},
{
"type": "capture"
},
{
"type": "partialCapture"
},
{
"type": "editCustomer"
},
{
"type": "editOrder"
},
{
"type": "extendOrderExpiry"
}
],
"createdAt": "2023-02-14T13:27:15.894811629Z",
"ledgerId": "in_256Qp7McaZtN8coxjAQW6tETyac",
"note": "",
"orderLines": [
{
"description": "Coffee Machine X200",
"id": "ol_256QpDt8q8yTUAoBytXsi5GbBgT",
"quantity": 10,
"reference": "111-222-333",
"totalAmount": 500000,
"totalVatAmount": 100000,
"type": "physical",
"unitPrice": 50000,
"vat": 2500
},
{
"description": "Shipping fee",
"id": "ol_256QpG5w2NjHIekT3JkcRPt5DJf",
"quantity": 1,
"reference": "444-555-666",
"totalAmount": 10000,
"totalVatAmount": 2000,
"type": "shippingFee",
"unitPrice": 10000,
"vat": 2500
}
],
"status": [],
"totalOrderAmount": {
"amount": "5100.00",
"currency": "SEK",
"formatted": "5,100.00",
"formattedWithCurrency": "SEK 5,100.00",
"minorUnits": 510000
},
"totalOrderAmountExclVat": {
"amount": "4080.00",
"currency": "SEK",
"formatted": "4,080.00",
"formattedWithCurrency": "SEK 4,080.00",
"minorUnits": 408000
},
"totalOrderVatAmount": {
"amount": "1020.00",
"currency": "SEK",
"formatted": "1,020.00",
"formattedWithCurrency": "SEK 1,020.00",
"minorUnits": 102000
}
},
"uncapturedAmount": {
"amount": "5100.00",
"currency": "SEK",
"formatted": "5,100.00",
"formattedWithCurrency": "SEK 5,100.00",
"minorUnits": 510000
},
"updatedAt": "2023-02-14T13:27:15.894811Z"
}
authorizeStatus
stringCan either be authorized
, or forced
depending on if invoice service is used or not.
events
array of eventsA list of event objects, or snapshots on the order.
Each object contains an amount
object with the strings amount
, currency
formatted
, formattedWithCurrency
and integer minorUnits
pertaining to the event.
The event object also contains the date string createdAt
as well as orderId
and ledgerId
, and finally the event type
.
Events can have one of the following types:
acknowledge
: Order has been acknowledged.authorize
: Order has been authorized.cancel
: Order has been cancelled.create
: Order has been created.edit
: The order lines etc have been edited since first authorized.editCustomer
: The customer details of the order have been edited.editPaymentMethod
: The payment method of the order has been changed.extendExpiry
: The expiry date of the order has been extended at least once.fullCapture
: All order lines have been captured.fullRefund
: All order lines have been added to a credit invoice.paid
: Order has been paid.partialCapture
: Some of the order lines have been captured.partialRefund
: Some of the order lines have been added to a credit invoice.readyForCapture
: Order has been made ready for capture.setReference
: The merchant's order reference has been updated.
metadata
objectOptionalMerchant may send a key/value object literal for internal use when creating a session, and can be retrieved from the order object later.
Example: { "property1": "value1", "property2": "value2" }
.
orderReference
stringA reference for the id
that is short and easier to read.
status
array of stringsA list of strings indicating the current status of the order (can be both captured and refunded, for instance).
cancelled
: Order has been cancelled.expired
: The expiry date of the order is passed.fullyCaptured
: All order lines have been captured.fullyPaid
: The order has been paid fully.fullyRefunded
: All order lines have been added to a credit invoice.partiallyCaptured
: Some of the order lines have been captured.partiallyPaid
: The order has been paid partially.partiallyRefunded
: Some of the order lines have been added to a credit invoice.unacknowledged
: The order has not yet been acknowledged.uncaptured
: The order has not yet been captured.
uncaptured
objectA sub order object containing details regarding an order's uncaptured state.
riskProfile
objectAn object with a list of tags
, for merchants that use invoice service. Possible tags:
blacklisted
creditDeclined
unknown
Can also be empty.
uncapturedAmount
nullAn object containing strings amount
, currency
, formatted
, formattedWithCurrency
and integer minorUnits
.