Skip to main content
POST
/
api
/
v2
/
platform
/
adjustments
Create an Adjustment
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    adjustment: {
      order_id: '<string>',
      label: 'Shipping costs',
      adjustable_id: '<string>',
      adjustable_type: 'Spree::LineItem',
      source_id: '<string>',
      source_type: 'Spree::TaxRate',
      amount: 10.9,
      mandatory: true,
      eligible: true,
      state: 'closed',
      included: true
    }
  })
};

fetch('http://{defaultHost}/api/v2/platform/adjustments', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
{
  "data": {
    "id": "5",
    "type": "adjustment",
    "attributes": {
      "source_type": "Spree::TaxRate",
      "adjustable_type": "Spree::LineItem",
      "amount": "100.0",
      "label": "Shipping",
      "mandatory": null,
      "eligible": true,
      "created_at": "2022-11-08T19:33:54.527Z",
      "updated_at": "2022-11-08T19:33:54.527Z",
      "state": "open",
      "included": false,
      "display_amount": "$100.00"
    },
    "relationships": {
      "order": {
        "data": {
          "id": "7",
          "type": "order"
        }
      },
      "adjustable": {
        "data": {
          "id": "1",
          "type": "line_item"
        }
      },
      "source": {
        "data": null
      }
    }
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

include
string

Select which associated resources you would like to fetch, see: https://jsonapi.org/format/#fetching-includes

Body

application/json
adjustment
object
required

Response

Record created

data
object
required