POST /receipts/_assignΒΆ
Assign a previously unassigned receipt to an identifier.
The receipt referenced using the receipt id, transaction_id or external_id
must exist.
The result may or may not return the receipt when an identifier is successfully assigned. Whether the receipt is returned depends on your requirements and how the authentication key you have been provided has been set up.
Query parameters:
Name |
Type |
Description |
|---|---|---|
|
boolean, optional, default: false |
readable output formatting |
Body parameters:
Name |
Type |
Description |
|---|---|---|
|
string, optional, mutually exclusive with |
the unique receipt identifier |
|
string, optional, mutually exclusive with |
retailer-specific transaction identifier |
|
string, optional, mutually exclusive with |
the external receipt identifier |
|
string, required |
retailer-specific consumer identifier (loyalty card number, e-mail address or other) |
Example request:
POST /receipts/_assign HTTP/1.1
Host: api.yocuda.com
Accept: application/json
Content-Length: 75
Content-Type: application/json
{
"transaction_id": "0123456789",
"identifier": "example@example.com"
}
Example response:
Success (with returned receipt):
When the key is configured to return the receipt:
HTTP/1.1 200 OK
Content-Length: ...
Content-Type: application/json; charset=UTF-8
{
"id": "513e2391ee5e525ff9000000",
"transaction_id": "0123456789",
"identifier": "email@example.com"
// ... remaining receipt content ...
}
See Receipt Object for a description of the receipt format.
Success (without returned receipt):
When the key is configured to not return receipt:
HTTP/1.1 204 No Content
Failure (identifier does not match the consumer):
Returned if the consumer query parameter is used and the posted identifier is not present in the consumer argument.
HTTP/1.1 403 Forbidden
Content-Length: 88
Content-Type: application/json
{
"description": "identifier and consumers don't match",
"status": "forbidden"
}
Failure (receipt does not exist):
Returned if the receipt does not exist.
HTTP/1.1 422 Unprocessable Entity
Content-Length: 113
Content-Type: application/json
{
"code": "receipt_not_found",
"description": "receipt not found",
"status": "unprocessable entity"
}