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": "85726e2a94aff35eaa15eca5",
"recipient": "recipient"
}
Response
{
"voucherSendReceipt": {
"_id": "7fe20bf547f30bf9a5613f58",
"type": "coupon",
"id": "example",
"value": 1.23,
"originalValue": 1.23,
"redeemType": "value",
"redeemed": true,
"isInRange": true,
"singleSpending": true,
"unlimited": true,
"spendings": [
{
"orderId": "example",
"orderRef": "78ee12c6090eefefc011b7ee",
"amount": 29.99,
"origin": "example",
"date": 1755244325803
}
],
"spendingLimit": 42,
"startDate": 1712947648173,
"expires": 1736147344733,
"resourcePath": "example",
"user": {
"type": "example",
"name": "example",
"email": "email@example.com",
"ref": "28cc0d0dd97a5ef1652567c1"
},
"created": 1726195750635,
"createdBy": {
"type": "example",
"name": "example",
"email": "email@example.com",
"ref": "b628dfe50346967711145a5f"
},
"note": {
"date": 1753538357246,
"content": "example"
},
"logs": [
{
"action": "example",
"description": "example",
"date": 1708848874889,
"ip": "example"
}
],
"recipients": [
{
"recipient": "example",
"date": 1715961617001
}
],
"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. |