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.

Show definition
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

Show all
action string

Ravelin's recommendation for whether to apply the voucher. Only present when score=voucherAssessment is passed.

One of: ALLOW, or PREVENT.

rules object

Details of the client rules triggered by this assessment.

Show definition
warnings array

Warnings when the request data may negatively impact abuse detection.

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

Feedback