Credit order

Credit an order for a specific merchant.

This operation enables you to:

  • Partly credit a specific order
  • Fully credit a specific order

When you credit an order you send which orderId it refers to and the below attributes:

  • type: type of transaction (CREDIT)
  • amount: amount on transaction, in order currency. If it is equal to residual order amount, order will be closed implicitly. 
  • transactionReference: merchant’s transaction reference. If supplied, will be returned as transactionReference when requesting balance transactions. 
  • debitTransaction: reference to associated debit transaction (id on custom object transaction). Mandatory if type is “CREDIT”.
  • closeDebit: closes the order for further debit transactions. It is not possible to make more debit transactions on a closed order but it is still possible to make credit transactions. If the parameter is not supplied the default value false will be used. Only applies if the debited amount is less than the order’s residual amount.
  • rows: rows on this order
  • message: message to cunsomer if the payment method allows it

1. Create credit transaction

To create a credit transaction on a specific 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.

POST /v1/orders/<orderId>/transactions

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

      "name":"Vit t-shirt",
      "description":"Bomull vit",

2. Handle response

The response will either be OK or an error code.

The response contains the following information:

  • orderStatus:  status on order, after transaction has been created
  • transaction: the created transaction
  • message: message to consumer if the payment method allows it
  • merchantId: 

 You can see all Ecsters custom objects here

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

Status: 201 Created

    "orderStatus": "PARTIALLY_DELIVERED",
    "transaction": {
        "id": "ReBEYzN24x1yKS58KC7H",
        "transactionReference": "transRef100",
        "type": "CREDIT",
        "created": "2018-12-16T20:37:53+01:00",
        "amount": 15000,
        "rows": [
                "name": "Vit t-shirt",
                "quantity": 1,
                "unitAmount": 15000,
                "vatRate": 2500,
                "partNumber": "00012",
                "description": "Bomull vit",
                "unit": "st",
                "discountAmount": 0,
                "serials": [],
                "fee": false
        "message": "TestMessage",
        "merchantId": "69260825"
Request test account