voucherSendReceipt Mutation
Description
Sends a voucher receipt email with PDF attachment to the specified recipient. Generates a PDF for the voucher if one doesn't exist. The email includes the voucher details and can be used for gift cards or coupons. Only works for non-redeemed vouchers.
mutation voucherSendReceipt($voucherRef: ID!, $recipient: String) {
voucherSendReceipt(voucherRef: $voucherRef, recipient: $recipient) {
_id
type
id
value
originalValue
redeemType
redeemed
isInRange
singleSpending
unlimited
spendings {
orderId
orderRef
amount
origin
date
}
spendingLimit
startDate
expires
resourcePath
user {
type
name
email
ref
}
created
createdBy {
type
name
email
ref
}
note {
date
content
}
logs {
action
description
date
ip
}
recipients {
recipient
date
}
pdf
}
}
Variables
{
"voucherRef": "d1b7798cdc2b717e52bddccd",
"recipient": "recipient"
}
Response
{
"voucherSendReceipt": {
"_id": "183ebb246423fccc4d6c5512",
"type": "coupon",
"id": "example",
"value": 1.23,
"originalValue": 1.23,
"redeemType": "value",
"redeemed": true,
"isInRange": true,
"singleSpending": true,
"unlimited": true,
"spendings": [
{
"orderId": "example",
"orderRef": "76a71bd27d19284ecd12b401",
"amount": 29.99,
"origin": "example",
"date": 1752934459847
}
],
"spendingLimit": 42,
"startDate": 1754600773307,
"expires": 1771032107224,
"resourcePath": "example",
"user": {
"type": "example",
"name": "example",
"email": "email@example.com",
"ref": "8e599066c5190ee332b56345"
},
"created": 1770689596860,
"createdBy": {
"type": "example",
"name": "example",
"email": "email@example.com",
"ref": "7ee1dfcfb6c5ae5d414fe242"
},
"note": {
"date": 1725469577694,
"content": "example"
},
"logs": [
{
"action": "example",
"description": "example",
"date": 1750194462442,
"ip": "example"
}
],
"recipients": [
{
"recipient": "example",
"date": 1747625101345
}
],
"pdf": "example"
}
}
Arguments
| Name | Type | Description |
|---|---|---|
voucherRef | ID! | Reference ID of the voucher to send a receipt for. |
recipient | String | Email address of the recipient to send the voucher receipt to. |