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": "4b098100f4c6979f2db77408",
"recipient": "recipient"
}
Response
{
"voucherSendReceipt": {
"_id": "64077f20921201f7a4053371",
"type": "coupon",
"id": "example",
"value": 1.23,
"originalValue": 1.23,
"redeemType": "value",
"redeemed": true,
"isInRange": true,
"singleSpending": true,
"unlimited": true,
"spendings": [
{
"orderId": "example",
"orderRef": "c80ae53cb876bf5b1134c078",
"amount": 29.99,
"origin": "example",
"date": 1778401379041
}
],
"spendingLimit": 42,
"startDate": 1739216921063,
"expires": 1745284801941,
"resourcePath": "example",
"user": {
"type": "example",
"name": "example",
"email": "email@example.com",
"ref": "1cbd990ed67d29deb7e93c6f"
},
"created": 1745877380110,
"createdBy": {
"type": "example",
"name": "example",
"email": "email@example.com",
"ref": "e19fe3667816e9f0d3c91a0b"
},
"note": {
"date": 1739124832498,
"content": "example"
},
"logs": [
{
"action": "example",
"description": "example",
"date": 1780586724435,
"ip": "example"
}
],
"recipients": [
{
"recipient": "example",
"date": 1746695796954
}
],
"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. |