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": "dcaef27830f1744c07779907",
"recipient": "recipient"
}
Response
{
"voucherSendReceipt": {
"_id": "48c5565658faede92190adec",
"type": "coupon",
"id": "example",
"value": 1.23,
"originalValue": 1.23,
"redeemType": "value",
"redeemed": true,
"isInRange": true,
"singleSpending": true,
"unlimited": true,
"spendings": [
{
"orderId": "example",
"orderRef": "1f4cd18b4e35b00b5f9cb2d1",
"amount": 29.99,
"origin": "example",
"date": 1721571871307
}
],
"spendingLimit": 42,
"startDate": 1714675117614,
"expires": 1750323201915,
"resourcePath": "example",
"user": {
"type": "example",
"name": "example",
"email": "email@example.com",
"ref": "cfb25220d3495394929fb3b8"
},
"created": 1766235940710,
"createdBy": {
"type": "example",
"name": "example",
"email": "email@example.com",
"ref": "1db4bc950e32db7a390ae3f2"
},
"note": {
"date": 1750689778403,
"content": "example"
},
"logs": [
{
"action": "example",
"description": "example",
"date": 1746149634982,
"ip": "example"
}
],
"recipients": [
{
"recipient": "example",
"date": 1734593162117
}
],
"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. |