Skip to main content

voucherDeactivate Mutation

Description

Deactivates a voucher by marking it as redeemed. The voucher cannot be used after deactivation. Only non-redeemed vouchers can be deactivated. Returns the updated voucher.

mutation voucherDeactivate($voucherRef: ID!) {
voucherDeactivate(voucherRef: $voucherRef) {
_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": "7535b8cecac454670aa44809"
}

Response

{
"voucherDeactivate": {
"_id": "6b4dedaae22d50816a8bee96",
"type": "coupon",
"id": "example",
"value": 1.23,
"originalValue": 1.23,
"redeemType": "value",
"redeemed": true,
"isInRange": true,
"singleSpending": true,
"unlimited": true,
"spendings": [
{
"orderId": "example",
"orderRef": "4dff013bb8d4703c41d95889",
"amount": 29.99,
"origin": "example",
"date": 1762644135769
}
],
"spendingLimit": 42,
"startDate": 1718026887788,
"expires": 1720414507432,
"resourcePath": "example",
"user": {
"type": "example",
"name": "example",
"email": "email@example.com",
"ref": "c60e53567179512c96431cef"
},
"created": 1716348614661,
"createdBy": {
"type": "example",
"name": "example",
"email": "email@example.com",
"ref": "e05941e46d2bd9fed131ca8c"
},
"note": {
"date": 1753336798360,
"content": "example"
},
"logs": [
{
"action": "example",
"description": "example",
"date": 1750985111036,
"ip": "example"
}
],
"recipients": [
{
"recipient": "example",
"date": 1761705484113
}
],
"pdf": "example"
}
}

Arguments

NameTypeDescription
voucherRefID!Reference ID of the voucher to deactivate.

Returns

Voucher