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": "68017e7617d415855b666726",
"recipient": "recipient"
}

Response

{
"voucherSendReceipt": {
"_id": "71ebb394cda251a8cf1bce40",
"type": "coupon",
"id": "example",
"value": 1.23,
"originalValue": 1.23,
"redeemType": "value",
"redeemed": true,
"isInRange": true,
"singleSpending": true,
"unlimited": true,
"spendings": [
{
"orderId": "example",
"orderRef": "7bcb518344a1cd54d1b27278",
"amount": 29.99,
"origin": "example",
"date": 1761217239301
}
],
"spendingLimit": 42,
"startDate": 1728730828934,
"expires": 1721485711735,
"resourcePath": "example",
"user": {
"type": "example",
"name": "example",
"email": "email@example.com",
"ref": "553cb311237e441b6ffb84e2"
},
"created": 1729597138754,
"createdBy": {
"type": "example",
"name": "example",
"email": "email@example.com",
"ref": "7ead79d7a189104e17747d80"
},
"note": {
"date": 1716403572778,
"content": "example"
},
"logs": [
{
"action": "example",
"description": "example",
"date": 1755381711238,
"ip": "example"
}
],
"recipients": [
{
"recipient": "example",
"date": 1717707959881
}
],
"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!