Skip to main content

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": "17a8bec40b70b7f0ad09d92d",
"recipient": "recipient"
}

Response​

{
"voucherSendReceipt": {
"_id": "ef4c06de6c4b669f331f05ca",
"type": "coupon",
"id": "example",
"value": 1.23,
"originalValue": 1.23,
"redeemType": "value",
"redeemed": true,
"isInRange": true,
"singleSpending": true,
"unlimited": true,
"spendings": [
{
"orderId": "example",
"orderRef": "996ff484162de19ae4a36978",
"amount": 29.99,
"origin": "example",
"date": 1766539340055
}
],
"spendingLimit": 42,
"startDate": 1734668182909,
"expires": 1757969236034,
"resourcePath": "example",
"user": {
"type": "example",
"name": "example",
"email": "email@example.com",
"ref": "6ddfa87b85e9f9f77db9dc5f"
},
"created": 1740069652399,
"createdBy": {
"type": "example",
"name": "example",
"email": "email@example.com",
"ref": "b289480cb596cf5ef908e772"
},
"note": {
"date": 1750011930731,
"content": "example"
},
"logs": [
{
"action": "example",
"description": "example",
"date": 1753295487356,
"ip": "example"
}
],
"recipients": [
{
"recipient": "example",
"date": 1789913989405
}
],
"pdf": "example"
}
}

Arguments​

NameTypeDescription
voucherRefID!Reference ID of the voucher to send a receipt for.
recipientStringEmail address of the recipient to send the voucher receipt to.

Returns​

Voucher!