POST /receipts/_send

Send a receipt to one or more channels.

The receipt referenced using the id or transaction_id must exist.

Available channels depend on the retailer’s configuration but may include email, sms and whatsapp.

Body parameters:

Name

Type

Description

id

string, optional

the unique receipt identifier

transaction_id

string, optional

retailer-specific transaction identifier

channels

sequence, required, min: 1

one or more channels to send the receipt to

email_address

string, optional

recipient email address - takes precedence over the email address found on the receipt

phone_number

string, optional

recipient phone number - takes precedence over the phone number found on the receipt

resolve

boolean, optional, default: false

do not send the receipt but instead return the available channels, email address and phone number

Example request:

POST /receipts/_send HTTP/1.1
Host: api.ereceipts.co.uk
Accept: application/json
Content-Length: 105
Content-Type: application/json

{
  "id": "513e2391ee5e525ff9000000",
  "channels": ["email"],
  "email_address": "example@example.com"
}

Example response:

Success:

HTTP/1.1 202 Accepted
Content-Length: 38
Content-Type: application/json

{
  "id": "513e2391ee5e525ff9000000"
}

Failure (receipt not found):

HTTP/1.1 422 Unprocessable Entity
Content-Length: 76
Content-Type: application/json

{
  "description": "receipt not found",
  "status": "unprocessable entity"
}

Failure (channel not available):

HTTP/1.1 422 Unprocessable Entity
Content-Length: 87
Content-Type: application/json

{
  "description": "sms channel is not available",
  "status": "unprocessable entity"
}

Failure (unprocessed receipt):

HTTP/1.1 409 Conflict
Content-Length: 76
Content-Type: application/json

{
  "description": "receipt processing is pending",
  "status": "conflict"
}

Determining available channels

The resolve flag may be used to retrieve the available channels, email address and/or phone number prior to sending. This is primarily useful for creating robust user interfaces.

Example request:

POST /receipts/_send HTTP/1.1
Host: api.ereceipts.co.uk
Accept: application/json
Content-Length: 101
Content-Type: application/json

{
  "id": "513e2391ee5e525ff9000000",
  "channels": ["email", "sms", "whatsapp"],
  "resolve": true
}

Example response:

In this example, the email and whatsapp channels are available but the customer did not provide a phone number.

HTTP/1.1 200 OK
Content-Length: 140
Content-Type: application/json

{
  "id": "513e2391ee5e525ff9000000"
  "channels": ["email", "whatsapp"],
  "email_address": "example@example.com",
  "phone_number": null
}