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

Response

{
"voucherSendReceipt": {
"_id": "ef23f605b1f9962586b0022d",
"type": "coupon",
"id": "example",
"value": 1.23,
"originalValue": 1.23,
"redeemType": "value",
"redeemed": true,
"isInRange": true,
"singleSpending": true,
"unlimited": true,
"spendings": [
{
"orderId": "example",
"orderRef": "36230506bdf1187a58b79931",
"amount": 29.99,
"origin": "example",
"date": 1763502520468
}
],
"spendingLimit": 42,
"startDate": 1763015479070,
"expires": 1756101781406,
"resourcePath": "example",
"user": {
"type": "example",
"name": "example",
"email": "email@example.com",
"ref": "c64152466fb9405f4e6d1311"
},
"created": 1723584345687,
"createdBy": {
"type": "example",
"name": "example",
"email": "email@example.com",
"ref": "98d5dd8a4920805ec38339c7"
},
"note": {
"date": 1743149065858,
"content": "example"
},
"logs": [
{
"action": "example",
"description": "example",
"date": 1708301692908,
"ip": "example"
}
],
"recipients": [
{
"recipient": "example",
"date": 1731088996799
}
],
"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!