Update Order

Update an order with a new amount or a different payment method.

Operation enables merchant to:
  • Update amount on order
  • Change payment method on order
  • Add or remove rows
  • Change description on rows

An order can only be updated when status is READY it can be updated multiple times until order is debited.

Update order takes the same parameters as Create order with one difference, parameter paymentOption is optional and should only be provided in the following cases:

  1. Consumer has explicitly chosen another payment option
  2. Cart amount has been updated. NOTE! Updating of cart content WITHOUT changing the cart amount does NOT require parameter paymentOption

In both cases above, a call to Get payment options must be done prior to Update order, thus providing the newly chosen payment option id in the Update order request.

For all other parameters the same validation rules apply as for Create order. Also, ALL attributes reflecting the order must be provided, just as in Create order. Omitting an optional parameter will result in deletion of that attribute if a value was set earlier.

Four different scenarios for PARTPAYMENT orders allow update and each scenario has its subset of available parameters to update:
  • (1) Consumer using strong identification, openReservation set to true
  • (2) Consumer using strong identification, openReservation set to false
  • (3) Consumer using weak identification, openReservation set to true
  • (4) Consumer using weak identification, openReservation set to false

Table below specifies updatable parameters for each scenario.

Scenario (1) (2) (3) (4)
paymentOption Yes No Yes No
cart Yes (Yes)*1 Yes (Yes)*1
orderReference Yes Yes Yes Yes
contactInfo Yes Yes Yes Yes
recipient Yes Yes No No
notificationURL Yes Yes Yes Yes
salesPerson Yes Yes Yes Yes
parameters Yes No Yes No
tags Yes Yes Yes Yes

*1: only updates that do NOT affect cart amount are allowed

When you  Update a order you have to send in the below attributes:

  • ticket: ticket used to identify consumer
  • paymentOption: how order should be paid. Use id returned in get available payment options for consumer
  • cart: object describing a cart
  • orderReference: merchant’s order reference
  • contactInfo: contact information for consumer. At least one of email/cellular must be provided
  • recipient: Order should be delivered to this recipient. May only be provided if allowed by payment option, see allowAlternateRecipient in Get available payment options for consumer
  • notificationURL: where async OEN should be sent
  • salesPerson: sales person contact information. Mandatory if inPersonset to true when creating ticket
  • parameters: see spec for orderSubtypeParameters object
  • tags: provide tags for statistics purposes.

An order in status READY can be updated multiple times until order is debited.

Update order takes the same parameters as Create order with one difference, parameter paymentOption is optional and should only be provided in the following cases:

  1. Consumer has explicitly chosen another payment option
  2. Cart amount has been updated. NOTE! Updating of cart content WITHOUT changing the cart amount does NOT require parameter paymentOption

In both cases above, a call to Get payment options must be done prior to Update order, thus providing the newly chosen payment option id in the Update order request.

For all other parameters the same validation rules apply as for Create order. Also, ALL attributes reflecting the order must be provided, just as in Create order. Omitting an optional parameter will result in deletion of that attribute if a value was set earlier.

 

Update order

To update a order you have to send the above attributes,  via a server-side call to our REST API. You’ll find the complete REST API reference here.

PUT /v1/orders/<orderId>

x-api-key: njdfdsdkjfl5598503mnfkfe
x-merchant-key: 86969769
Content-Type: application/json

{
  "ticket":"{{sessionId}}",
  "paymentOption":"3LG8nHTw7F6rQubz7yg8",
  "cart":{
    "amount":400000,
    "currency":"SEK",
    "rows":[{
      "name":"Test name def value",
      "quantity":1.0,  "unitAmount":400000,
      "vatRate":2500,
      "partNumber":"00012",
      "description":"TestDescription",
      "unit":"st",
      "discountAmount":0,
      "serials":[],
      "fee":false,
      "provided":false
    }],
    "message":"TestMessageDefValue"
  },
  "contactInfo":{
    "email":"pada09@ecster.se",
    "cellular":{
      "country":"46",
      "number":"707333444"
    },
    "phone":{
      "country":"46",
      "number":"707333444"
    }
  },
  "orderReference":"orderReferenceDefValue",
  "notificationURL":"https://secure.ft.ecster.se/osn/APIv1",
  "parameters":{
    "issueCard":true,
    "openReservation":true,
    "directDebit":false
  },
  "recipient":{
    "name":null,
    "address":null,
    "contactInfo":null
  },
  "salesPerson":{
    "name":{
      "firstName":"Test name def value",
      "lastName":"TestLastNameDefValue",
      "title":"TestTitleDefValue"
    },
    "address":null,
    "contactInfo":{
      "email":"user@mail.com",
      "cellular":{
        "country":"46",
        "number":"707333444"
      },
      "phone":{
        "country":"46",
        "number":"707333444"
      }
    }
  },
  "tags":[],
  "platform":{
    "reference":"123e4567-e89b-12d3-a456-426655440000",
    "info":"platformInfoDefValue"
  }
}

Handle the response

You can either get OK response, or an error.

The response contains following information:

  • order:  object that holds the information of the updated order

 You can see all Ecsters custom objects here

Below you have an example of the response from the request above.

Status: 200 OK

{
    "order": {
        "id": "wHwaZLeD0hBjO97z6DXm",
        "merchantId": "100646739",
        "status": "READY",
        "properties": {
            "method": "PARTPAYMENT",
            "submethod": "PARTPAYMENT_SE_1",
            "startFee": 0,
            "adminFee": 1500,
            "perMonth": 401500,
            "payments": 1,
            "creditCost": 1500,
            "new": false,
            "accountNumber": "97522060****8879",
            "previousCreditLimit": 600000,
            "availableAmount": 80000,
            "openReservation": true,
            "directDebit": false
        },
        "created": "2018-04-19T11:53:16+02:00",
        "amount": 400000,
        "currency": "SEK",
        "debitedAmount": 0,
        "creditedAmount": 0,
        "orderReference": "orderReferenceDefValue",
        "consumer": {
            "nationalId": "SE490623-5389",
            "name": {
                "firstName": "Sara",
                "lastName": "Bjuhr"
            },
            "address": {
                "line1": "Kvarnbergsvägen 16 B",
                "city": "Hägersten",
                "zip": "12944"
            },
            "contactInfo": {
                "email": "pada09@ecster.se",
                "cellular": {
                    "number": "0707333444"
                },
                "phone": {}
            }
        },
        "transactions": [
            {
                "id": "Qn5a50bU6FVq9zvds7Se",
                "type": "ORIGINAL",
                "created": "2018-04-19T11:53:16+02:00",
                "amount": 400000,
                "rows": [
                    {
                        "name": "Test name def value",
                        "quantity": 1,
                        "unitAmount": 400000,
                        "vatRate": 2500,
                        "partNumber": "00012",
                        "description": "TestDescription",
                        "unit": "st",
                        "discountAmount": 0,
                        "serials": [],
                        "fee": false
                    }
                ],
                "message": "TestMessageDefValue",
                "merchantId": "100646739"
            }
        ],
        "tags": [],
        "agreementPdfUrl": "https://secure1.ft.ecster.se/rest/se/sv/agreement/pdf/MT",
        "localizedInfo": [
            {
                "id": "agreementPdfUrl",
                "text": "kontoavtal",
                "value": "https://secure1.ft.ecster.se/rest/agreement/pdf/MTU"
            },
            {
                "id": "debitConsentPdfUrl",
                "text": "debiteringsunderlag",
                "value": "https://secure1.ft.ecster.se/rest/debitconsent/pdf/wH6DXm"
            },
            {
                "id": "amount",
                "text": "belopp",
                "value": "4 000",
                "unit": "kr"
            },
            {
                "id": "startFee",
                "text": "uppläggningsavgift",
                "value": "0",
                "unit": "kr"
            },
            {
                "id": "adminFee",
                "text": "administrativ avgift",
                "value": "15",
                "unit": "kr"
            },
            {
                "id": "payments",
                "text": "antal betalningar",
                "value": "1"
            },
            {
                "id": "perMonth",
                "text": "betalning per månad",
                "value": "4 015",
                "unit": "kr"
            },
            {
                "id": "creditCost",
                "text": "kreditkostnad",
                "value": "15",
                "unit": "kr"
            },
            {
                "id": "method",
                "text": "betalningssätt",
                "value": "Delbetala"
            },
            {
                "id": "decisionMessage",
                "text": "",
                "value": "Ehandel_Delbetalning_Befintlig_Leveransklar"
            }
        ],
        "debitConsentPdfUrl": "https://secure1.ft.ecster.se/rest/debitconsent/pdf/wH",
        "debitConsentInfo": {
            "text": "Debit consent text",
            "localizedInfo": [
                {
                    "id": "date",
                    "text": "datum",
                    "value": "2018-04-19+02:00"
                },
                {
                    "id": "amount",
                    "text": "belopp",
                    "value": "4 000",
                    "unit": "kr"
                },
                {
                    "id": "orderReference",
                    "text": "ordernummer",
                    "value": "orderReferenceDefValue"
                },
                {
                    "id": "customerName",
                    "text": "namn",
                    "value": "Sara Bjuhr"
                },
                {
                    "id": "accountNumber",
                    "text": "kontonummer",
                    "value": "97522060****8879"
                },
                {
                    "id": "paymentMethod",
                    "text": "betalningssätt",
                    "value": "Delbetala"
                }
            ]
        }
    }
}
Request test account