POST api/orders


Creates a new order and returns the checkout to the webshop.

You can optionally add presetvalues to the call as well. These values will prefill the identification in the checkout. If a preset value has IsReadOnly, the customer will not be able to modify the value.

Important!

Quantity, UnitPrice, DiscountPercent and VatPercent for each order row is expected to be given in minor currency.

var Cart = {
    Items: [{                   // In this example we create
        Quantity: 100,          // one item
        Name: "Computer",       // called “Computer”
        UnitPrice: 500000,      // with a price of 5000 SEK,
        DiscountPercent: 1000,  // a discount of 10%
        VatPercent: 2500        // and 25% VAT
    }]
};
Info
  • HTTP status code 201 indicates success, everything else indicates a failure.

Request Information

URI Parameters

Name Description Type Additional Information

Body Parameters

Object as JSON containing MerchantSettings and Cart-information.

CreateOrderModel

Name Description Type Additional Information
countryCode String None.
currency String None.
locale String None.
clientOrderNumber String None.
merchantSettings MerchantSettings None.
cart Cart None.
presetValues Collection of PresetValue None.
identityFlags IdentityFlags None.
partnerKey Provided by Svea to select partners. Guid Optional.

Request Formats

{
  "countryCode": "SE",
  "currency": "SEK",
  "locale": "sv-SE",
  "clientOrderNumber": "1234ABCD",
  "merchantSettings": {
    "CheckoutValidationCallBackUri": "https://your.domain/validation-callback/{checkout.order.uri}",
    "PushUri": "https://your.domain/push-callback/{checkout.order.uri}",
    "TermsUri": "https://your.domain/terms/",
    "CheckoutUri": "https://your.domain/checkout-callback/",
    "ConfirmationUri": "https://your.domain/confirmation-callback/",
    "ActivePartPaymentCampaigns": null,
    "PromotedPartPaymentCampaign": 0
  },
  "cart": {
    "Items": [
      {
        "ArticleNumber": "ABC80",
        "Name": "Computer",
        "Quantity": 100,
        "UnitPrice": 500000,
        "DiscountPercent": 1000,
        "VatPercent": 2500,
        "Unit": null,
        "TemporaryReference": null,
        "RowNumber": 1
      }
    ]
  },
  "presetValues": [
    {
      "TypeName": "EmailAddress",
      "Value": "test.person@svea.com",
      "IsReadonly": true
    }
  ],
  "identityFlags": null,
  "partnerKey": null
}
<createOrderModel xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/SveaCheckout.Ws.Contract.Version1">
  <cart>
    <Items>
      <OrderRow>
        <ArticleNumber>ABC80</ArticleNumber>
        <DiscountPercent>1000</DiscountPercent>
        <Name>Computer</Name>
        <Quantity>100</Quantity>
        <RowNumber>1</RowNumber>
        <TemporaryReference i:nil="true" />
        <Unit i:nil="true" />
        <UnitPrice>500000</UnitPrice>
        <VatPercent>2500</VatPercent>
      </OrderRow>
    </Items>
  </cart>
  <clientOrderNumber>1234ABCD</clientOrderNumber>
  <countryCode>SE</countryCode>
  <currency>SEK</currency>
  <identityFlags i:nil="true" />
  <locale>sv-SE</locale>
  <merchantSettings>
    <ActivePartPaymentCampaigns xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" i:nil="true" />
    <CheckoutUri>https://your.domain/checkout-callback/</CheckoutUri>
    <CheckoutValidationCallBackUri>https://your.domain/validation-callback/{checkout.order.uri}</CheckoutValidationCallBackUri>
    <ConfirmationUri>https://your.domain/confirmation-callback/</ConfirmationUri>
    <PromotedPartPaymentCampaign>0</PromotedPartPaymentCampaign>
    <PushUri>https://your.domain/push-callback/{checkout.order.uri}</PushUri>
    <TermsUri>https://your.domain/terms/</TermsUri>
  </merchantSettings>
  <partnerKey i:nil="true" />
  <presetValues>
    <PresetValue>
      <IsReadonly>true</IsReadonly>
      <TypeName>EmailAddress</TypeName>
      <Value>test.person@svea.com</Value>
    </PresetValue>
  </presetValues>
</createOrderModel>
Failed to generate the sample for media type 'application/x-www-form-urlencoded'. Cannot use formatter 'JQueryMvcFormUrlEncodedFormatter' to write type 'CreateOrderModel'.

Response Information

Resource Description

An object containing all information needed to return a checkout to the merchant, see structure below.

Data

Name Description Type Additional Information
MerchantSettings Specific merchant URIs MerchantSettings Required.
Cart Order rows. Cart None.
Customer Identified customer of the order. Customer None.
ShippingAddress Shipping address of identified customer. Address None.
BillingAddress Billing address of identified customer. Address None.
Gui Gui None.
Locale The current locale of the checkout, i.e.sv-SE etc. String Required.
Currency The current currency as defined by ISO 4217, i.e. SEK, NOK etc. String Required.
CountryCode Defined by two-letter ISO 3166-1 alpha-2, i.e. SE, DE, FI etc. String None.
PresetValues A list containing the preset values, if any. Collection of PresetValue None.
ClientOrderNumber A string that identifies the order in the merchant’s systems. String Required. Max length: 32. Min length: 1.
OrderId Int64 None.
EmailAddress String None.
PhoneNumber The customer’s phone number String None.
PaymentType The final payment method for the order. Will only have a value when the order is finalized, otherwise null.
  • INVOICE
  • ADMININVOICE
  • ACCOUNT
  • PAYMENTPLAN
  • SVEACARDPAY
  • SVEACARDPAY_PF
  • Or one of the following direct bank types. (For the most recent list of available banks check the Payment Gateway documentation.)
    • BANKAXESS (BankAxess, Norway)
    • DBAKTIAFI (Aktia, Finland)
    • DBALANDSBANKENFI (Ålandsbanken, Finland)
    • DBDANSKEBANKSE (Danske bank, Sweden)
    • DBNORDEAFI (Nordea, Finland)
    • DBNORDEASE (Nordea, Sweden)
    • DBPOHJOLAFI (OP-Pohjola, Finland)
    • DBSAMPOFI (Sampo, Finland)
    • DBSEBSE (SEB, Individuals, Sweden)
    • DBSEBFTGSE (SEB, companies, Sweden)
    • DBSHBSE (Handelsbanken, Sweden)
    • DBSPANKKIFI (S-Pankki, Finland)
    • DBSWEDBANKSE (Swedbank, Sweden)
    • DBTAPIOLAFI (Tapiola, Finland)
String None.
Status The current state of the order CheckoutOrderStatus None.
CustomerReference B2B Customer reference String None.
SveaWillBuyOrder True = Svea will buy this invoice. False = Svea will not buy this invoice. null = Selected payment method is not Invoice. Boolean None.
IdentityFlags IdentityFlags None.

Response Formats

{
  "MerchantSettings": {
    "CheckoutValidationCallBackUri": "https://your.domain/validation-callback/{checkout.order.uri}",
    "PushUri": "https://your.domain/push-callback/{checkout.order.uri}",
    "TermsUri": "https://your.domain/terms/",
    "CheckoutUri": "https://your.domain/checkout-callback/",
    "ConfirmationUri": "https://your.domain/confirmation-callback/",
    "ActivePartPaymentCampaigns": [
      1111,
      2222,
      3333,
      4444
    ],
    "PromotedPartPaymentCampaign": 1111
  },
  "Cart": {
    "Items": [
      {
        "ArticleNumber": null,
        "Name": null,
        "Quantity": 0,
        "UnitPrice": 0,
        "DiscountPercent": 0,
        "VatPercent": 0,
        "Unit": null,
        "TemporaryReference": null,
        "RowNumber": 1
      },
      {
        "ArticleNumber": null,
        "Name": null,
        "Quantity": 0,
        "UnitPrice": 0,
        "DiscountPercent": 0,
        "VatPercent": 0,
        "Unit": null,
        "TemporaryReference": null,
        "RowNumber": 2
      }
    ]
  },
  "Customer": {
    "Id": 1,
    "NationalId": "121314-1234",
    "CountryCode": "SE",
    "IsCompany": false
  },
  "ShippingAddress": {
    "FullName": "John Doe",
    "FirstName": "John",
    "LastName": "Doe",
    "StreetAddress": "My Street 1",
    "CoAddress": "",
    "PostalCode": "99999",
    "City": "My Town",
    "CountryCode": "SE",
    "IsGeneric": false,
    "AddressLines": null
  },
  "BillingAddress": {
    "FullName": "John Doe",
    "FirstName": "John",
    "LastName": "Doe",
    "StreetAddress": "My Street 1",
    "CoAddress": "",
    "PostalCode": "99999",
    "City": "My Town",
    "CountryCode": "SE",
    "IsGeneric": false,
    "AddressLines": null
  },
  "Gui": {
    "Layout": "desktop",
    "Snippet": "<iframe src=\"\"></iframe>"
  },
  "Locale": "sv-SE",
  "Currency": "SEK",
  "CountryCode": "SE",
  "PresetValues": [
    {
      "TypeName": "NationalId",
      "Value": "121314-1234",
      "IsReadonly": true
    },
    {
      "TypeName": "EmailAddress",
      "Value": "john.doe@svea.com",
      "IsReadonly": true
    },
    {
      "TypeName": "PhoneNumber",
      "Value": "070-1234567",
      "IsReadonly": true
    },
    {
      "TypeName": "PostalCode",
      "Value": "99999",
      "IsReadonly": true
    },
    {
      "TypeName": "IsCompany",
      "Value": "false",
      "IsReadonly": true
    }
  ],
  "ClientOrderNumber": "ABCDEFGHIJKLMNOP0123456789",
  "OrderId": 1234567890,
  "EmailAddress": "john.doe@svea.com",
  "PhoneNumber": "070-1234567",
  "PaymentType": "INVOICE",
  "Status": "Final",
  "CustomerReference": null,
  "SveaWillBuyOrder": false,
  "IdentityFlags": {
    "HideNotYou": false,
    "HideChangeAddress": true,
    "HideAnonymous": true
  }
}
<Data xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/SveaCheckout.Ws.Contract.Version1">
  <BillingAddress>
    <AddressLines xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" i:nil="true" />
    <City>My Town</City>
    <CoAddress></CoAddress>
    <CountryCode>SE</CountryCode>
    <FirstName>John</FirstName>
    <FullName>John Doe</FullName>
    <IsGeneric>false</IsGeneric>
    <LastName>Doe</LastName>
    <PostalCode>99999</PostalCode>
    <StreetAddress>My Street 1</StreetAddress>
  </BillingAddress>
  <Cart>
    <Items>
      <OrderRow>
        <ArticleNumber i:nil="true" />
        <DiscountPercent>0</DiscountPercent>
        <Name i:nil="true" />
        <Quantity>0</Quantity>
        <RowNumber>1</RowNumber>
        <TemporaryReference i:nil="true" />
        <Unit i:nil="true" />
        <UnitPrice>0</UnitPrice>
        <VatPercent>0</VatPercent>
      </OrderRow>
      <OrderRow>
        <ArticleNumber i:nil="true" />
        <DiscountPercent>0</DiscountPercent>
        <Name i:nil="true" />
        <Quantity>0</Quantity>
        <RowNumber>2</RowNumber>
        <TemporaryReference i:nil="true" />
        <Unit i:nil="true" />
        <UnitPrice>0</UnitPrice>
        <VatPercent>0</VatPercent>
      </OrderRow>
    </Items>
  </Cart>
  <ClientOrderNumber>ABCDEFGHIJKLMNOP0123456789</ClientOrderNumber>
  <CountryCode>SE</CountryCode>
  <Currency>SEK</Currency>
  <Customer>
    <CountryCode>SE</CountryCode>
    <Id>1</Id>
    <IsCompany>false</IsCompany>
    <NationalId>121314-1234</NationalId>
  </Customer>
  <CustomerReference i:nil="true" />
  <EmailAddress>john.doe@svea.com</EmailAddress>
  <Gui>
    <Layout>desktop</Layout>
    <Snippet>&lt;iframe src=""&gt;&lt;/iframe&gt;</Snippet>
  </Gui>
  <IdentityFlags>
    <HideAnonymous>true</HideAnonymous>
    <HideChangeAddress>true</HideChangeAddress>
    <HideNotYou>false</HideNotYou>
  </IdentityFlags>
  <Locale>sv-SE</Locale>
  <MerchantSettings>
    <ActivePartPaymentCampaigns xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:long>1111</d3p1:long>
      <d3p1:long>2222</d3p1:long>
      <d3p1:long>3333</d3p1:long>
      <d3p1:long>4444</d3p1:long>
    </ActivePartPaymentCampaigns>
    <CheckoutUri>https://your.domain/checkout-callback/</CheckoutUri>
    <CheckoutValidationCallBackUri>https://your.domain/validation-callback/{checkout.order.uri}</CheckoutValidationCallBackUri>
    <ConfirmationUri>https://your.domain/confirmation-callback/</ConfirmationUri>
    <PromotedPartPaymentCampaign>1111</PromotedPartPaymentCampaign>
    <PushUri>https://your.domain/push-callback/{checkout.order.uri}</PushUri>
    <TermsUri>https://your.domain/terms/</TermsUri>
  </MerchantSettings>
  <OrderId>1234567890</OrderId>
  <PaymentType>INVOICE</PaymentType>
  <PhoneNumber>070-1234567</PhoneNumber>
  <PresetValues>
    <PresetValue>
      <IsReadonly>true</IsReadonly>
      <TypeName>NationalId</TypeName>
      <Value>121314-1234</Value>
    </PresetValue>
    <PresetValue>
      <IsReadonly>true</IsReadonly>
      <TypeName>EmailAddress</TypeName>
      <Value>john.doe@svea.com</Value>
    </PresetValue>
    <PresetValue>
      <IsReadonly>true</IsReadonly>
      <TypeName>PhoneNumber</TypeName>
      <Value>070-1234567</Value>
    </PresetValue>
    <PresetValue>
      <IsReadonly>true</IsReadonly>
      <TypeName>PostalCode</TypeName>
      <Value>99999</Value>
    </PresetValue>
    <PresetValue>
      <IsReadonly>true</IsReadonly>
      <TypeName>IsCompany</TypeName>
      <Value>false</Value>
    </PresetValue>
  </PresetValues>
  <ShippingAddress>
    <AddressLines xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" i:nil="true" />
    <City>My Town</City>
    <CoAddress></CoAddress>
    <CountryCode>SE</CountryCode>
    <FirstName>John</FirstName>
    <FullName>John Doe</FullName>
    <IsGeneric>false</IsGeneric>
    <LastName>Doe</LastName>
    <PostalCode>99999</PostalCode>
    <StreetAddress>My Street 1</StreetAddress>
  </ShippingAddress>
  <Status>Final</Status>
  <SveaWillBuyOrder>false</SveaWillBuyOrder>
</Data>