A valid request URL is required to generate request examples{
"event": "<string>",
"customer": {
"id": "<string>",
"source_id": "<string>",
"metadata": {},
"object": "<string>"
},
"earning_rules": [
{
"id": "<string>",
"name": "<string>",
"metadata": {},
"object": "<string>"
}
],
"memberships": [
{
"member": {
"id": "<string>",
"customer_id": "<string>",
"program_id": "<string>",
"metadata": {},
"object": "<string>"
},
"program": {
"id": "<string>",
"name": "<string>",
"metadata": {},
"object": "<string>"
},
"cards": [
{
"card": {
"id": "<string>",
"card_definition_id": "<string>",
"card_type": "INDIVIDUAL",
"code": "<string>",
"object": "<string>"
},
"points_estimation": 123,
"earning_rules": [
{
"earning_rule": {
"id": "<string>",
"object": "<string>"
},
"points_estimation": 123,
"object": "<string>"
}
],
"object": "<string>"
}
],
"benefits": [
{
"benefit": {
"id": "<string>",
"name": "<string>",
"object": "<string>"
},
"earning_rules": [
{
"earning_rule": {
"id": "<string>",
"object": "<string>"
},
"object": "<string>"
}
],
"object": "<string>"
}
],
"object": "<string>"
}
],
"object": "<string>"
}{
"code": 123,
"key": "<string>",
"message": "<string>",
"details": "<string>",
"request_id": "<string>"
}{
"code": 123,
"key": "<string>",
"message": "<string>",
"details": "<string>",
"request_id": "<string>"
}{
"code": 123,
"key": "<string>",
"message": "<string>",
"details": "<string>",
"request_id": "<string>"
}{
"code": 123,
"key": "<string>",
"message": "<string>",
"details": "<string>",
"request_id": "<string>"
}Examine earning rules
⚠️ BETA endpoint
This is a work-in-progress documentation of a BETA endpoint. The parameters, fields, request and response bodies, and other data may subject to change. If you want to share feedback or improvements, contact Voucherify support or your Technical Account Manager.
Estimates earning opportunities for a customer without triggering any actual earning.
The trigger selects whether all trigger events or one specific event is examined.
When a specific event is selected, exactly one matching context object is required:
customer_order_paid for customer.order.paid, customer_segment_entered for
customer.segment.entered, and customer_custom_event for customer.custom_event
(the other context objects must not be present).
curl --request POST \
--url {protocol}://{host}/v2/loyalties/examine/earning-rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-App-Id: <api-key>' \
--header 'X-App-Token: <api-key>' \
--data '
{
"trigger": {
"specific": {}
},
"customer_identification": {
"customer_id": "<string>",
"customer_source_id": "<string>",
"member_id": "<string>"
},
"customer_order_paid": {
"customer": {
"metadata": {}
},
"member": {
"metadata": {}
},
"order": {
"amount": "<string>",
"initial_amount": "<string>",
"discount_amount": "<string>",
"items": [
{
"id": "<string>",
"source_id": "<string>",
"product_id": "<string>",
"sku_id": "<string>",
"amount": "<string>",
"discount_amount": "<string>",
"quantity": "<string>",
"price": "<string>",
"product": {
"id": "<string>",
"source_id": "<string>",
"price": "<string>"
},
"sku": {
"id": "<string>",
"source_id": "<string>",
"price": "<string>"
},
"metadata": {}
}
],
"metadata": {}
}
},
"customer_segment_entered": {
"customer": {
"metadata": {}
},
"member": {
"metadata": {}
}
}
}
'{
"event": "<string>",
"customer": {
"id": "<string>",
"source_id": "<string>",
"metadata": {},
"object": "<string>"
},
"earning_rules": [
{
"id": "<string>",
"name": "<string>",
"metadata": {},
"object": "<string>"
}
],
"memberships": [
{
"member": {
"id": "<string>",
"customer_id": "<string>",
"program_id": "<string>",
"metadata": {},
"object": "<string>"
},
"program": {
"id": "<string>",
"name": "<string>",
"metadata": {},
"object": "<string>"
},
"cards": [
{
"card": {
"id": "<string>",
"card_definition_id": "<string>",
"card_type": "INDIVIDUAL",
"code": "<string>",
"object": "<string>"
},
"points_estimation": 123,
"earning_rules": [
{
"earning_rule": {
"id": "<string>",
"object": "<string>"
},
"points_estimation": 123,
"object": "<string>"
}
],
"object": "<string>"
}
],
"benefits": [
{
"benefit": {
"id": "<string>",
"name": "<string>",
"object": "<string>"
},
"earning_rules": [
{
"earning_rule": {
"id": "<string>",
"object": "<string>"
},
"object": "<string>"
}
],
"object": "<string>"
}
],
"object": "<string>"
}
],
"object": "<string>"
}{
"code": 123,
"key": "<string>",
"message": "<string>",
"details": "<string>",
"request_id": "<string>"
}{
"code": 123,
"key": "<string>",
"message": "<string>",
"details": "<string>",
"request_id": "<string>"
}{
"code": 123,
"key": "<string>",
"message": "<string>",
"details": "<string>",
"request_id": "<string>"
}{
"code": 123,
"key": "<string>",
"message": "<string>",
"details": "<string>",
"request_id": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Request body for examining earning rules.
When trigger.type is SPECIFIC, the context object matching the specific event is
required and the other context objects must not be present:
customer.order.paid -> customer_order_paid,
customer.segment.entered -> customer_segment_entered,
customer.custom_event -> customer_custom_event.
Which trigger events to examine. With ALL, all trigger events are examined and specific must be null/absent. With SPECIFIC, specific is required.
Show child attributes
Show child attributes
How the examined customer is identified. Depending on type, exactly one of customer_id, customer_source_id or member_id is required; the other two must not be present.
Show child attributes
Show child attributes
Context for examining customer.order.paid earning rules.
Show child attributes
Show child attributes
Context for examining customer.segment.entered earning rules.
Show child attributes
Show child attributes
Context for examining customer.custom_event earning rules. With type = ALL, all is required and specific must be null/absent. With SPECIFIC, specific is required and all must be null/absent.
Show child attributes
Show child attributes
Response
Earning rules examination result
Earning rules examination result.
Examined trigger event (e.g. customer.order.paid, customer.segment.entered, customer.custom_event).
Customer reference in examine results.
Show child attributes
Show child attributes
All earning rules that matched during examination (deduplicated).
Show child attributes
Show child attributes
Earning opportunities per program membership.
Show child attributes
Show child attributes
Object type marker. Always earnings_examine_result.
"earnings_examine_result"Was this page helpful?

