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

Response

{
"voucherSendReceipt": {
"_id": "2daa4c84948859b59182f8c8",
"type": "coupon",
"id": "example",
"value": 1.23,
"originalValue": 1.23,
"redeemType": "value",
"redeemed": true,
"isInRange": true,
"singleSpending": true,
"unlimited": true,
"spendings": [
{
"orderId": "example",
"orderRef": "219e0fa45c229fcbf08facce",
"amount": 29.99,
"origin": "example",
"date": 1725293608378
}
],
"spendingLimit": 42,
"startDate": 1761282854765,
"expires": 1744636794643,
"resourcePath": "example",
"user": {
"type": "example",
"name": "example",
"email": "email@example.com",
"ref": "0a680318054fc4006a68d074"
},
"created": 1730969247624,
"createdBy": {
"type": "example",
"name": "example",
"email": "email@example.com",
"ref": "138df1fd98a854cea2235db7"
},
"note": {
"date": 1710128638578,
"content": "example"
},
"logs": [
{
"action": "example",
"description": "example",
"date": 1724129362850,
"ip": "example"
}
],
"recipients": [
{
"recipient": "example",
"date": 1756405189685
}
],
"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!