Create an adjustment

How to create an adjustment via API

To create a new adjustment, send a POST request to the /api/adjustments endpoint, passing the resource arguments in the request body.

Request

POST https://yourdomain.commercelayer.io/api/adjustments

Arguments

Body ParameterTypeRequired

type

string

Required

attributes.name

string

Required

attributes.currency_code

string

Required

attributes.amount_cents

integer

Required

attributes.distribute_discount

boolean

Optional, default is 'true'

attributes.reference

string

Optional

attributes.reference_origin

string

Optional

attributes.metadata

object

Optional

Example

The following request creates a new adjustment:

curl -g -X POST \
  'https://yourdomain.commercelayer.io/api/adjustments' \
  -H 'Accept: application/vnd.api+json' \
  -H 'Authorization: Bearer your-access-token' \
  -H 'Content-Type: application/vnd.api+json' \
  -d '{
  "data": {
    "type": "adjustments",
    "attributes": {
      "name": "Additional service",
      "currency_code": "EUR",
      "amount_cents": 1500
    }
  }
}'

Last updated