🚧 Work in Progress: This documentation is actively being developed and is subject to change.
Core Functions

Receipt Scanning

Learn how to upload receipts using the hosted pages or direct API upload.


Overview

Receipt scanning transforms purchase receipts into sustainability data. Users upload their receipts, and Reewild's system extracts products, matches them to our database, and calculates PlanetPoints.

There are two integration approaches:

  1. Hosted Pages - Redirect users to Reewild's hosted upload page
  2. Direct Upload - Send receipt images directly via API

The hosted pages provides a fully-managed upload experience. Your application initiates a session, redirects the user to the hosted page, and receives results via webhooks.

Initialize Session

Create a session to get a redirect URL:

Endpoint: POST /track/receipts/session

Required field:

  • userId - The enrolled user's ID

Optional fields:

  • transactionId - Your transaction reference
  • amount - Transaction total
  • merchantName - Store name
  • redirectUri - Return URL after upload
  • transactionTimestamp - Purchase date/time (ISO 8601)

Response:

{
  "redirectUrl": "https://hosted.planetpoints.com?sessionId=xxx"
}

Redirect User

Direct the user to the redirectUrl. After upload, they'll be redirected to your redirectUri (if provided) or the page will auto-close.

Handle Results

Listen for webhook events to track processing:

  • receipt_uploaded - Image received
  • receipt_extracted - OCR complete
  • receipt_validated - Receipt verified
  • receipt_completed - Points awarded
  • receipt_failed - Processing error

See Webhooks for payload details.


Direct Upload

For full control over the upload experience, send receipt images directly via API.

Endpoint: POST /track/receipts

Content-Type: multipart/form-data

Required fields:

FieldTypeDescription
userIdStringEnrolled user's ID
transactionIdStringYour transaction reference
amountNumberTransaction total (min: 0.01)
merchantNameStringStore name
receiptImageFileReceipt image (JPEG/PNG)
transactionTimestampDateTimePurchase date/time (ISO 8601)

Response:

{
  "receiptID": "rec_abc123...",
  "message": "Receipt uploaded successfully"
}

Check Processing Status

Poll for status if you're not using webhooks:

Endpoint: GET /track/receipts/{id}/status

Returns the current processing stage and any available data from completed stages.


Processing Stages

Receipts progress through these stages:

  1. Uploaded - Image received and stored
  2. Extracted - OCR extracted line items
  3. Enriched - Products matched to database
  4. Validated - Receipt verified
  5. Scored - Points calculated
  6. Completed - Processing finished

Each stage updates the receipt status with relevant data.


Error Handling

Common error codes returned in receipt_failed webhooks:

Error CodeDescription
MERCHANT_NAME_NOT_FOUNDStore couldn't be identified
NO_VALID_FOOD_ITEMSNo eligible products found
NOT_AUTHENTICDuplicate or fraudulent receipt
ALREADY_EXISTSReceipt already processed

Next Steps