Coupon Redemption

Retrieving a list of redemptions by criteria

get

Retrieves a list of redemptions by the specified criteria. Supports sorting and paging.

The endpoint was previously available under the /coupon-v2/ base path.


Required scopes

  • coupon.coupon_manage

Authorizations
Path parameters
codestringRequired

Code of a coupon

tenantstring · min: 3 · max: 16Required

The tenant that the caller is acting upon.

Please note that this value is always lowercase.

Query parameters
sortstringOptional

The list of comma-separated properties used to sort the results. By default, the column values are sorted in ascending order. Can either be in the form of fieldName or fieldName:asc,fieldName:desc. If you want to sort by localized attributes, you must use the following form: fieldName.language or fieldName.language:asc,fieldName.language:desc.

pageNumberinteger · min: 1Optional

The page number to be retrieved where the size of the pages must be specified by the pageSize parameter. The number of the first page is 1.

Default: 1
pageSizeinteger · min: 1Optional

The number of documents being retrieved on the page.

Default: 16
totalCountbooleanOptional

This parameter requests to return the total number of object in the collection fulfilling the criteria together with the response. This number will be returned in the 'items-count' header.

qstringOptional

The simple query criteria based on available fields to limit returned results or a set of modified documents.

Responses
200
List of redemptions
application/json
get
GET /coupon/{tenant}/coupons/{code}/redemptions HTTP/1.1
Host: api.emporix.io
Authorization: Bearer YOUR_OAUTH2_TOKEN
Accept: */*
[
  {
    "id": "6429b8fdf8fd8e0001df1617",
    "code": "10-OFF",
    "customerNumber": "61443563",
    "orderTotal": {
      "amount": 299.3,
      "currency": "USD"
    },
    "discount": {
      "amount": 29.93,
      "currency": "USD"
    },
    "redeemedAt": "2023-04-02T17:18:53.701Z"
  },
  {
    "id": "642aa7f5f8fd8e0001df161b",
    "code": "10-OFF",
    "customerNumber": "61443563",
    "orderTotal": {
      "amount": 369.07,
      "currency": "USD"
    },
    "discount": {
      "amount": 36.91,
      "currency": "USD"
    },
    "redeemedAt": "2023-04-03T10:18:29.233Z"
  }
]

Redeeming the coupon by creating a redemption

post

Invalidate the coupon based on its validity scope. Redemption is not possible when the coupon has exceeded its maximum number allowed redemptions. To be redeemed a coupon needs to be already valid and not expired yet.

The endpoint was previously available under the /coupon-v2/ base path.


Required scopes

  • coupon.coupon_redeem_on_behalf - needed only if the service should use the customer identification specified in the request body (customerNumber attribute) instead of the one associated with current authentication token.

Authorizations
Path parameters
codestringRequired

Code of a coupon

tenantstring · min: 3 · max: 16Required

The tenant that the caller is acting upon.

Please note that this value is always lowercase.

Body

Defines a coupon redemption request payload that affects a coupon instance.

orderCodestringOptional

Code of the associated order.

customerNumberstringOptional

The customer Id of the user, e.g. C0123456789. Can be specified only if coupon.coupon_redeem_on_behalf scope is present.

legalEntityIdstringOptional

The id of the legal entity to which customer is assigned. When customer is assigned to many legal entities then he can redeem the same coupon separately for each legal entity.

orderTotalall ofRequired
and
anyOptional

The amount of the purchase.

discountall ofRequired
and
anyOptional

The absolute amount of the granted discount.

Responses
201
The coupon has been redeemed and the redemption has been successfully created.
application/json
post
POST /coupon/{tenant}/coupons/{code}/redemptions HTTP/1.1
Host: api.emporix.io
Authorization: Bearer YOUR_OAUTH2_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 118

{
  "customerNumber": "CustomerId",
  "orderTotal": {
    "amount": 1090,
    "currency": "EUR"
  },
  "discount": {
    "amount": 5,
    "currency": "EUR"
  }
}
{
  "id": "6058912da917ae6f360f2557"
}

Retrieving a coupon redemption

get

Retrieves a single redemption.

The endpoint was previously available under the /coupon-v2/ base path.


Required scopes

  • coupon.coupon_manage for accessing any redemption.

  • coupon.coupon_redeem for accessing only redemption created by current user.

  • coupon.coupon_redeem_on_behalf - needed only if the service should use the customer identification specified in the request body (customerNumberattribute) instead of the one associated with current authentication token.

Authorizations
Path parameters
idstringRequired
codestringRequired

Code of a coupon

tenantstring · min: 3 · max: 16Required

The tenant that the caller is acting upon.

Please note that this value is always lowercase.

Query parameters
customerNumberstringOptional

Customer number (ID) of customer on behalf of which we request coupon information. Needed only in case of retrieving coupon eligible for other customer than the caller.

Responses
200
The coupon redemption has been successfully retrieved.
application/json
get
GET /coupon/{tenant}/coupons/{code}/redemptions/{id} HTTP/1.1
Host: api.emporix.io
Authorization: Bearer YOUR_OAUTH2_TOKEN
Accept: */*
{
  "id": "6429b8fdf8fd8e0001df1617",
  "code": "10-OFF",
  "customerNumber": "61443563",
  "orderTotal": {
    "amount": 299.3,
    "currency": "USD"
  },
  "discount": {
    "amount": 29.93,
    "currency": "USD"
  },
  "redeemedAt": "2023-04-02T17:18:53.701Z"
}

Deleting a coupon redemption

delete

Deletes a previously created redemption.

The endpoint was previously available under the /coupon-v2/ base path.


Required scopes

  • coupon.coupon_manage

Authorizations
Path parameters
idstringRequired
codestringRequired

Code of a coupon

tenantstring · min: 3 · max: 16Required

The tenant that the caller is acting upon.

Please note that this value is always lowercase.

Responses
204
A redemption with the provided code has been successfully deleted.
delete
DELETE /coupon/{tenant}/coupons/{code}/redemptions/{id} HTTP/1.1
Host: api.emporix.io
Authorization: Bearer YOUR_OAUTH2_TOKEN
Accept: */*

No content

Was this helpful?