Get Order Status
Information about an order can be retrieved using this endpoint. It's used when a callback about updated order status has been received, or when polling for status updates.
info
To not overload the API´s it is not allowed to poll for order status more than once each 5 second. A forbidden response will be returned if status is fetched too often.
Endpoint
Method: GET
/api/v1/orders/{merchantOrderNumber}/status
Request
URI Parameters
Name | Description | Type |
---|---|---|
merchantOrderNumber | merchantOrderNumber from the Merchant system used while creating the Instore Order | String |
Code sample
- C#
Get Order Example
namespace Instore
{
using APIPortal_CodeSamples;
using Microsoft.Extensions.DependencyInjection;
using System.Net.Http.Headers;
public class GetOrderStatus
{
public static async Task GetOrderStatusAsync(string merchantOrderNumber)
{
var services = new ServiceCollection();
services.AddHttpClient("MyApiClient", client =>
{
client.BaseAddress = new Uri("https://webpayinstoreapistage.svea.com");
});
var serviceProvider = services.BuildServiceProvider();
var httpClientFactory = serviceProvider.GetRequiredService<IHttpClientFactory>();
var httpClient = httpClientFactory.CreateClient("MyApiClient");
// Add authorization header
Authentication.BasicAuthenticationToken(out byte[] token);
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(token));
var apiUrl = string.Format("/api/v1/orders/{0}/status", merchantOrderNumber);
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);
}
}
}
}
Response
- Response Model
- Response Sample
Name | Description | Type |
---|---|---|
merchantOrderNumber | A string that identifies the order in the merchant’s systems. | String |
instoreUiUri | Instore URL generated | String |
orderStatus | Active, Expired, Completed, Cancelled | String |
paymentMethodType | Payment Method customer used , if the Order is completed | String |
campaignCode | Campaign code is the payment method is PaymentPlan | String |
paymentType | String | |
paymentOrderId | Checkout Order Id which identifies an Order , which can be used for managing Orders | Long |
customerInformation | Information about the customer if the Order is completed | Customer |
tags | Array of String | |
orderItems | Order Items |
application/json
{
"merchantOrderNumber": "234234235-5",
"instoreUiUri": "https://instorestage.svea.com/wkxyjm",
"orderStatus": "Active",
"paymentMethodType": null,
"campaignCode": null,
"paymentType": null,
"paymentOrderId": 9270411,
"customerInformation": {
"shippingAddress": null,
"billingAddress": null,
"emailAddress": null,
"mobilePhoneNumber": null
},
"tags": [],
"orderItems": [
{
"articleNumber": "abc123",
"name": "Headphones",
"quantity": 1000,
"unitPrice": 2000,
"discountPercent": 0,
"discountAmount": 0,
"vatPercent": 2500,
"unit": "st",
"rowNumber": 1,
"merchantData": "Size: M"
},
{
"articleNumber": "abc1234",
"name": "Headphones-1",
"quantity": 2000,
"unitPrice": 3000,
"discountPercent": 0,
"discountAmount": 0,
"vatPercent": 2500,
"unit": "st",
"rowNumber": 2,
"merchantData": "Size: L"
}
]
}