Magic Receipt callbacks

This page describes on how to utilize callbacks for different magic receipt states.

What is a Magic Receipt callback?

A magic receipt callback is a specific callback only sent for magic receipt state changes (also called stateful magic receipt callbacks). The magic receipt callbacks work differently from the general reward callbacks since you will receive all the different states of a receipt and additional information about the receipt.

How to set up Magic Receipts callbacks

To set up the magic receipt stateful callbacks, visit the Publisher Dashboard -> Apps -> Your App -> Integration -> Magic Receipts Callback:

IMPORTANT: You can enable the stateful magic receipts callbacks which have the following effects:

  • Magic receipt callbacks for all states will be sent now (Before only COMPLETED would be sent)
  • The transaction ID for each state change will be the same
  • The TYPE parameter will return the type state_change

To configure a new URL, press the cog wheel to open the callback URL configurator:

Multiple fields have to be filled out:

  • Callback URL Host: Enter the callback endpoint URL you have set up.
  • Protocol: In most cases, you want to leave it as is.
  • Callback Parameter: Here you can add all the parameters you need to process the callbacks correctly. We highly recommend that you have the following parameters in there: UID, TX, VAL, and RAW.
    • For magic receipts, we also recommend to add the magic_receipt_state parameter. magic_receipt_state will return the state of a receipt: PENDING, REVIEWING, RECONCILED, COMPLETED. Learn more about the magic receipt states here.
  • Custom Parameter: In case you want to attach a parameter yourself, you can add it here. However, it does only support static parameters.
  • Example URL: This shows you an example callback URL that you would receive. Keep in mind the hash in the example is not a valid one!

Here is an example of how a callback URL could be configured:

Press the Save button and then the Save Changes button in the top right.

Magic Receipt states

Each offer callback will have a different state. The following states are available:

COMPLETED: The COMPLETED callback will be sent when a receipt is approved. This is the only final state and can not change.

PENDING: A PENDING callback will be sent when a reward for a magic receipt is pending. After a PENDING callback was sent, a COMPLETED or RECONCILED can follow.

REVIEWING: A REVIEWING callback will be sent when a receipt goes into manual review. A support person takes a look at the receipt. After a REVIEWING callback was sent, a COMPLETED or RECONCILED can follow. REVIEWING can only occur once after a RECONCILIED was fired. A specific receipt submission can only be once in REVIEWING.

RECONCILED: A RECONCILED callback will be sent when a magic receipt is rejected. You can use the reason and reason ID macros to learn more about the rejection. A RECONCILED state is never final and can change to a COMPLETED or REVIEWING.

🚧

Make sure to only reward users for magic_receipt_state=COMPLETED callbacks!

Magic Receipt parameters

For magic receipts we do provide additional parameters for additional information:

ParameterTypeDescription
[%MAGIC_RECEIPT_STATE%]StringIt can only be used when using Stateful Magic Receipts Callbacks. One of: COMPLETED, PENDING, RECONCILED, REVIEWING
[%RECEIPT:OFFER:ID%]IntegerReturns the offer ID
[%RECEIPT:OFFER:NAME%]StringReturns the offer name
[%RECEIPT:UPLOAD:ID%]IntegerReturns an ID that is associated to an upload
[%RECEIPT:UPLOAD:OFFER:ID%]IntegerReturns the offer ID
[%MAGIC_RECEIPT_REASON%]StringReturns the reason why a receipt got rejected or approved.
[%MAGIC_RECEIPT_REASON_ID%]IntegerReturns the id of the reason.

For a full list of all parameters click here. For more information on the magic receipt reasons, click here.

How to test Magic Receipt callbacks

We offer a callback tester on the dashboard to test your configured callback endpoints. Learn more about it here.

Legacy way of testing

🚧

The following part of the documentation explains how callbacks were tested before the callback tester on the dashboard existed. We highly recommend not using the following method anymore!

You can simulate a callback by following these steps:

  1. Set up the magic receipts callback
  2. Copy the URL in the configuration modal at the bottom
  3. Replace the hash in the URL with the real hash according to this page
  4. Replace the reward amount, state and user ID with the correct ones
  5. Open the URL in the web browser

This will send you a callback with which you can test your system.

Magic Receipt Reasons and Reason IDs

In the following table you can see all the different reason IDs and descriptions.

statusIDDescriptionDescription
1Pending ReviewPending automated review
2RejectedError parsing receipt - manual reviews disabled
3RejectedReceipt is duplicate - different member
4RejectedOffer no longer available
5RejectedOffer not added to member list
6RejectedUnable to parse receipt merchant (legacy)
7RejectedUnrecognized receipt merchant
8RejectedSelected merchantID and receipt merchant mismatch (legacy)
9RejectedOffer purchased at incorrect merchant
10RejectedUnable to parse receipt date
11RejectedReceipt date before offer start date
12RejectedReceipt date after offer end date
13RejectedMember already completed offer max number of times
14RejectedNo matching line items found
15RejectedInsufficient quantity available for offer
16RejectedPartner rejected completion
17ApprovedAwarded
18RejectedInternal error
19RejectedNo goals found
20RejectedAll goals capped
21RejectedOffer already in manual review
22RejectedAn error occurred. Rolling back award
23Pending ReviewPending manual review - manual offer
24Pending ReviewUnder manual review
25ApprovedAwarded manually
26RejectedIncomplete receipt
27RejectedDuplicate receipt - manual review
28Pending ReviewUser requested manual review pending
29RejectedOffer purchased at incorrect state (legacy)
30Pending ReviewDuplicate receipt from same user. Forced into manual review
31RejectedFraud
32Pending ReviewMember previously uploaded fraud reciept - Forced manual review
33Pending ReviewRate limiter prevented : Successfully uploaded x receipts
34Pending ReviewRate limiter prevented : Redeemed X awards
35Pending ReviewRate limiter prevented : Earned X dollars
36Pending ReviewAwaiting E-Receipt Email
37RejectedMatching E-Receipt Email Not Found
39RejectedDuplicate Any receipt
40ApprovedAdmin Courtesy Award
41RejectedReceipt Date Out Of Range
42ApprovedFirst time courtesy award
43RejectedOffer purchased at incorrect medium
44Pending ReviewPending COS Review
45RejectedError Uploading to COS
46RejectedOffer Already Under COS Review
47RejectedNon COS Offer
48RejectedReceipt Is A Screen
49Pending ReviewCOS Import: Under review
50RejectedCOS Import: Receipt denied
51RejectedCOS Import: Receipt ineligible
52ApprovedCOS Import: Awarded
53RejectedCOS Import: Receipt approved, offer denied
54RejectedCOS Import: Receipt approved, error awarding
55RejectedRekognition Fraud
56Award PendingAutomated approved, award pending
57ApprovedAward credited after pending period
58ApprovedManually credited pending award
59RejectedBulk Transition - Rejected
60ApprovedBulk Transition - Standard Award
61ApprovedBulk Transition - Courtesty Award
62Pending ReviewRekognition Possible Fraud
63Pending ReviewRekognition Certain Fraud - Pending Manual Review
64RejectedDuplicate Receipt Same Offer Awarded
65RejectedReceipt Contains Banned Phrases
66RejectedAny Receipt Already Used
67RejectedAll Line Items Are For Curbside Pickup
68RejectedOffer already Pending
69Award PendingRate Limiter Pending: Successfully uploaded x receipts
70Award PendingRate Limiter Pending: Redeemed X awards
71Award PendingRate Limiter Pending: Earned X dollars
72RejectedAll Line Items Have Incorrect Order Status
73RejectedREKOGNITION_FRAUD_MANUAL_REVIEW_DISABLED
74RejectedRATE_LIMITER_AWARD_PENDING_DISABLED
75Pending ReviewQUOTIENT_PENDING_UPLOAD
76Pending ReviewQUOTIENT_PENDING_REVIEW
77RejectedQUOTIENT_FAILED_UPLOAD
78RejectedQUOTIENT_REJECTED
79RejectedQUOTIENT_DUPLICATE_RECEIPT
80Award PendingQUOTIENT_APPROVED_AWARD_PENDING
81RejectedQUOTIENT_APPROVED_ERROR_AWARDING
82RejectedQUOTIENT_EXPIRE_OLD_UPLOADS
83RejectedQUOTIENT_RECEIPT_DATE_BEFORE_ACTIVATION
84RejectedQUOTIENT_NO_TRANSACTION_ID
85Pending ReviewPending Manual Review - Admin Requested
86RejectedImage Size Inadequate - Possible Fraud
87Pending ReviewQUOTIENT_MANUAL_REVIEW
88RejectedQUOTIENT_MANUAL_REVIEW_REJECTED
89RejectedQUOTIENT_MANUAL_REVIEW_ALREADY_REVIEWED
90RejectedQUOTIENT_MANUAL_REVIEW_INSUFFICIENT_QUANTITY
91ApprovedQUOTIENT_MANUAL_REVIEW_APPROVED
92RejectedQUOTIENT_MANUAL_REVIEW_FRAUD
93ApprovedQUOTIENT_APPROVED_AUTOMATED
94Pending ReviewQuantity mismatch - manual review
95Award PendingBarcode Scan Award
96ApprovedOverrode Expired Upload
97Pending ReviewAuto Manual Review
98Award PendingAll Line Items Are For Curbside Pickup Allowed
99RejectedBad Barcode
100Pending ReviewSecondary Manual Review
101Pending ReviewError Parsing Receipt Retry Upload
102RejectedError Parsing Receipt Retry Failed
103Pending ReviewSecondary Manual Review From Approval
104Pending ReviewQUOTIENT_SECONDARY_MANUAL_REVIEW
105ApprovedQUOTIENT_APPROVED_SECONDARY_MANUAL_REVIEW