Getting order information
Description
To access information about an Order, call the Endpoint. This response includes data regarding Order Rows, Deliveries, Credits and Addresses. It's essential to include both the Authorization and Timestamp in the header for successful retrieval of this information.
Endpoint
Method: GET
/api/v1/orders/{CheckoutOrderId}
Sample Code
- C#
- Response
GET Order Example
using Microsoft.Extensions.DependencyInjection;
static async Task GetOrderAsync(long checkoutOrderId)
{
var services = new ServiceCollection();
services.AddHttpClient("MyApiClient", client =>
{
client.BaseAddress = new Uri("http://paymentadminapistage.svea.com/api/");
});
var serviceProvider = services.BuildServiceProvider();
var httpClientFactory = serviceProvider.GetRequiredService<IHttpClientFactory>();
var httpClient = httpClientFactory.CreateClient("MyApiClient");
// Add authorization header
Authentication.CreateAuthenticationToken(out string token, out string timestamp);
httpClient.DefaultRequestHeaders.Add("Authorization", token);
httpClient.DefaultRequestHeaders.Add("Timestamp", timestamp);
var apiUrl = string.Format("v1/orders/{0}", checkoutOrderId);
try
{
HttpResponseMessage response = await httpClient.GetAsync(apiUrl);
// Check if the request was successful
if (response.IsSuccessStatusCode)
{
string responseData = await response.Content.ReadAsStringAsync();
Console.WriteLine("Response: " + responseData);
}
else
{
Console.WriteLine("Failed to retrieve data. Status code: " + response.StatusCode);
}
}
catch (HttpRequestException ex)
{
Console.WriteLine("Error: " + ex.Message);
}
}
GET Order Response
{
"Id": 9118224,
"Currency": "SEK",
"MerchantOrderId": "585c1942b0104c7c9dd280e8da4a5331",
"OrderStatus": "Delivered",
"SystemStatus": "SUCCESS",
"SystemStatusMessage": "SUCCESS",
"PaymentCreditStatus": null,
"EmailAddress": "myemail@me.com",
"BillingEmailAddress": null,
"PhoneNumber": "1234567890",
"CustomerReference": null,
"PeppolId": null,
"PaymentType": "Swish",
"CreationDate": "2024-04-03T13:56:08",
"NationalId": "123407192384",
"IsCompany": false,
"CancelledAmount": 0,
"OrderAmount": 52800,
"BillingAddress": {
"FullName": "FirstName LastName",
"StreetAddress": "Address 1",
"CoAddress": null,
"PostalCode": "12345",
"City": null,
"CountryCode": "SE",
"Source": 0
},
"ShippingAddress": {
"FullName": "FirstName LastName",
"StreetAddress": "Address 1",
"CoAddress": null,
"PostalCode": "12345",
"City": "Cityname",
"CountryCode": "SE",
"Source": 1
},
"Deliveries": [
{
"Id": 86521923793,
"CreationDate": "2024-04-03T13:56:08",
"InvoiceId": null,
"DeliveryAmount": 49900,
"CreditedAmount": 0,
"Credits": null,
"OrderRows": [
{
"OrderRowId": 1,
"ArticleNumber": "ArticleNo1",
"Name": "Artcle 1",
"Quantity": 100,
"UnitPrice": 49900,
"DiscountPercent": 0,
"DiscountAmount": 0,
"VatPercent": 2500,
"Unit": null,
"IsCancelled": false,
"Actions": []
}
],
"Actions": [
"CanCreditAmount"
],
"Status": null,
"DueDate": null
}
],
"OrderRows": [
{
"OrderRowId": 2,
"ArticleNumber": "ArticleNo2",
"Name": "Article 2",
"Quantity": 100,
"UnitPrice": 2900,
"DiscountPercent": 0,
"DiscountAmount": 0,
"VatPercent": 2500,
"Unit": null,
"IsCancelled": false,
"Actions": []
}
],
"Actions": [],
"SveaWillBuy": null,
"ExpirationDate": null,
"BillingReferences": []
}
Request parameters
Parameter | Type | Description |
---|---|---|
CheckoutOrderId required | Long | Checkout OrderId for the order |
info
The call needs to include the Authentication header. Please refer documentation.
Response
Name | Description | Type |
---|---|---|
Id | Checkout-order ID for the order. | Long |
Currency | Order currency as defined by ISO 4217, i.e. SEK, NOK etc. | String |
MerchantOrderId | Unique orderId in merchant’s system. Refer to clientOrderNumber in createOrder | String |
OrderStatus | The current state of the order. | OrderStatus |
SystemStatus | Internal system status. | SystemStatus |
SystemStatusMessage | SystemStatusMessage | |
PaymentCreditStatus | Credit status of the Order | PaymentCreditStatus |
EmailAddress | The customer’s email address. | String |
BillingEmailAddress | Email address of identified customer. | String |
PhoneNumber | The customer’s phone number. | String |
CustomerReference | Only available on Invoice order. | String |
PeppolId | Peppol Identifier. | String |
PaymentType | Payment method for the finalized order. | PaymentType |
CreationDate | Date and time when the order was created. | DateTime |
NationalId | Personal- or organization number. NOTE: Masked for FI orders for compliance purpose. Is it masked in NO? | String |
IsCompany | True if national ID is an organization number. False if national ID is a personal number. | Boolean |
CancelledAmount | The total cancelled amount of the order. | Long |
OrderAmount | The total amount of the order. | Long |
BillingAddress | Billing address of customer. Masked for FI orders for compliance purpose unless end-customer provided or Bankid signed. | BillingAddress |
ShippingAddress | Shipping address of customer. Masked for FI orders for compliance purpose unless end-customer provided or Bankid signed. | ShippingAddress |
Deliveries | List of deliveries for the Order. | Deliveries |
OrderRows | List of order rows for the Order. | OrderRows |
Actions | A list of actions possible on the order. | Actions |
SveaWillBuy | Only available on Invoice order. Is true if Svea buys the invoice. | Boolean |
ExpirationDate | Date and time when the order will be expired. | DateTime |
BillingReferences | List of different types of references added. | BillingReferences |
Order Status
Name | Description |
---|---|
Cancelled | The order is fully cancelled. |
Delivered | The order is fully delivered. |
Failed | The payment for this order has failed. |
Open | The order is open and active. This includes partially delivered orders. |
Expired | The order has expired. This is applicable for Invoice, Account credit and Payment plan order types. |
System Status
Name | Description |
---|---|
NEW | The request was authenticated and accepted. |
RECEIVED | The request is saved, ready to be processed. |
VALID | Request has passed all the antifraud checks and all the checks specific to the current payment method (e.g.: currency is not allowed, phone number format,missing mandatory field...). |
PENDING | Payment has been initialized; waiting for the external provider/bank to respond or due to the reasons specified in SystemStatusMessage |
REGISTERED | Recurring payment was authorized by the end-user (only card payments). |
RESPONSE_RECEIVED | Callback from the external provider/bank was received. |
FAILED | Request did not pass the validation checks (e.g.antifraud, mandatory fields, not allowed value ...); Unexpected error while processing payment (internal or external error); Payment was not accepted by the external provider/bank. |
ERROR | Payment status could not be retrieved from the external provider/bank system. |
CANCELLED | Payment was cancelled before payer authorized it. |
ANNULLED | Payment was cancelled after payer authorized it. |
AUTHORIZED | Payer authorized the request. The amount is blocked but not withdrawn from the end-user account (only card payments). |
CONFIRMED | Payment was confirmed; ready to be captured. The confirmation can be done automatically or manually by the merchant (only card payments). |
CAPTPENDING | The process of withdrawing money from end-user account started (only card payments). |
CAPTFAILED | The withdraw could not be performed (only card payments). |
SUCCESS | Payment completed; money was withdrawn from the end-user account. |
Closed | Order is Closed |
Active | Order is Open |
Payment Type
Name |
---|
AccountCredit |
Card |
DirectBank |
Invoice |
PaymentPlan |
Swish |
Mobilepay |
Vipps |
Address
Name | Description | Type |
---|---|---|
FullName | Company: name of the company. Individual: first and last name(s). | String |
StreetAddress | Street address. | String |
CoAddress | C/o address. | String |
PostalCode | Postal code. | String |
City | Customer's entered city. | String |
CountryCode | 2-letter ISO country code. | String |
Source | 1 = Fetched from Address Directory, 2 = Customer entered, 5 = BankId Signed | Long |
Delivery
Name | Description | Type |
---|---|---|
Id | Delivery ID. | Long |
CreationDate | Date and time when the order was delivered. | DateTime |
InvoiceId | Invoice identification number. Only set if the payment method is invoice. | Long |
DeliveryAmount | The total amount of the delivery. | Long |
CreditedAmount | The total credited amount of the delivery. | Long |
Credits | List of credit rows. | Credits |
OrderRows | List of order rows which are delivered. | OrderRows |
Actions | A list of actions possible on the delivery. | Actions |
Status | Payment status for the delivery. | Payment Status |
DueDate | Due date for the payment. | DateTime |
Credit
Name | Description | Type |
---|---|---|
Amount | Credited amount. | Long |
OrderRows | List of order rows credited. | OrderRows |
Actions | A list of possible actions on the credit. | Actions |
Order Row
Name | Description | Type |
---|---|---|
OrderRowId | Order row ID from underlying system, unique on order. | Long |
ArticleNumber | Article number as a string. Can contain letters and numbers. | String |
Name | Article name. | String |
Quantity | Quantity of the product. | Long |
UnitPrice | Price of the product including VAT. | Long |
DiscountPercent | The discount percentage of the product. | Long |
DiscountAmount | The discount amount of the product. | Long |
VatPercent | The VAT percentage of the current product. | Long |
Unit | The unit type, e.g., “st”, “pc”, “kg” etc. | String |
IsCancelled | Determines if the row is cancelled. | Boolean |
Actions | A list of actions possible on the order row. | Actions |
Payment Credit Status
Name | Description |
---|---|
CREDNONE | No credit has happened for this transaction |
CREDPENDING | Credit has initiated , but pending to be captured |
CREDSUCCESS | Credit is successful |
Actions
The order undergoes a range of actions, each determined by the values assigned to the Action parameter.
Name | Description |
---|---|
CanDeliverOrder | Available on Open Orders |
CanDeliverPartially | Available on Open Orders |
CanCancelOrder | Available on Open Orders |
CanCancelAmount | Available on Open Orders with Payment type cardBank Swish Vipps Mobilepay |
CanUpdateOrderRow | Available on Orders with out delivered Order Rows InvoiceAccount Credit Paymentplan |
CanAddOrderRow | Available on Open, Partially Delivered Orders |
CanCancelOrderRow | Available on Open, Partially Delivered Orders |
Delivery Actions
Name | Description |
---|---|
CanCreditAmount | Available for Orders with Paymenttype cardBank Swish Vipps Mobilepay |
CanCreditNewRow | Available for Orders with Paymenttype InvoiceAccount Credit Paymentplan |
CanCreditOrderRows | Available for Orders with Paymenttype InvoiceAccount Credit Paymentplan |
Order Row Actions
Available for Orders with Paymenttype InvoiceAccount Credit Paymentplan |
Name |
---|
CanCreditRow |
CanDeliverRow |
CanCancelRow |
CanUpdateRow |
Billing References
Name |
---|
Undefined |
Purchase |
ContactPerson |
InvoiceReference |
CostCenter |
InvoiceRecipient |
LetterNumber |
AccountingNumber |
System Status Message
Name | Description |
---|---|
SUCCESS | Order status is Success |
Non official delivery address | Order is in Pending status due to delivery address missing |
High Amount | Order is in Pending status due to High Amount and a manual intervention required by Svea to Approve the Order |
Delivery payment status
Name |
---|
Sent |
Paid |
DebtCollection |
Converted |
Credited |
Overdue |
Reminded |
Cancelled |
Response Code
Code | HttpStatusCode | Description |
---|---|---|
200 | Ok | Order successfully retrieved |
400 | BadRequest | Order cannot be found |
403 | Forbidden | Merchant is not authorized to retrieve information |
401 | Unauthorized | Merchant is not authorized to retrieve information |
404 | NotFound | Order cannot be found |