Voucher (v3)

To request a recommendation at this endpoint use the Voucher Assessment checkpoint. Ravelin will return a recommendation of ALLOW or PREVENT.

Promo abuse recommendations need to be enabled on your account before they can be used. Please speak to your account manager about enabling promo abuse recommendations.

Field Status Definitions
Required Required fields must be sent. If the data is not sent Ravelin will return an error.
Important Important fields are crucial for performance where that data is relevant for your business.
Optional Optional fields are additional data points that can be shared with Ravelin.
These fields are unlikely to impact performance but may be visible in the Ravelin dashboard.

Jump to Response

POST api.ravelin.com/v3/voucher?score=voucherAssessment

Use this endpoint when a customer enters a voucher or promo code and before you apply the code.

Show all
timestamp integer required

The time at which this data payload was valid. When sending events in realtime, this will usually be 'now'. This is used to merge data that arrives out-of-order.

A Unix timestamp preferably as an integer count of milliseconds since 1970-01-01T00:00 UTC (nanoseconds are also accepted).

customer object required

The customer applying the voucher or promo code. Always sent as an object, even when only the ID is known.

Show definition
voucher object required

The single code being assessed in this call. One code in, one recommendation out.

Show definition
device object important

Standard Ravelin device object. Device/IP/session reuse across accounts is a core collusion signal, available at code-entry time regardless of cart or order state. Mutually exclusive with deviceId.

Show definition
deviceId string optional

Reference to a previously-sent device. Mutually exclusive with device.

Minimum length: 1
Maximum length: 300
orderId string optional

Send when an order or basket identifier already exists on the merchant side.

Minimum length: 1
POST https://api.ravelin.com/v3/voucher?score=voucherAssessment HTTP/1.1
Authorization: token ...
Content-Type: application/json

{
  "timestamp": 1512828988826,
  "customer": {
    "customerId": "customer-123",
    "email": "jsmith123@example.com"
  },
  "voucher": {
    "voucherCode": "20OFF",
    "valueType": "PERCENTAGE",
    "percentage": 20,
    "maxDiscountValue": 1500,
    "currency": "GBP",
    "voucherType": "GENERAL"
  },
  "device": {
    "deviceId": "device-123",
    "ipAddress": "81.152.92.84"
  },
  "orderId": "order-987"
}

Response

action string

Ravelin's recommendation for whether to apply the voucher.

One of: ALLOW or PREVENT.

rules object

Details of the client rules triggered by this assessment.

rules.triggered array

The client rules triggered by this assessment.

rules.triggered[].ruleId integer

The ID of the rule which triggered.

rules.triggered[].ruleVersion integer

The version of the rule which triggered.

rules.triggered[].action string

The recommendation produced by the rule.

rules.triggered[].triggered boolean

Whether the rule triggered. This is always true.

rules.triggered[].state string

Whether the rule was in live or test mode.

One of: active or passive.

warnings array

Warnings when the request data may negatively impact abuse detection.

warnings[].class string

The identifier for this warning.

warnings[].help string

A link to more information about this warning.

warnings[].msg string

Why the warning was issued.

{
  "action": "ALLOW",
  "rules": {
    "triggered": [
      {
        "ruleId": 1,
        "ruleVersion": 1,
        "action": "ALLOW",
        "triggered": true,
        "state": "active"
      }
    ]
  }
}

Feedback