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": "46acbd3ce3550e0d9a93e565"
}
Response
{
"voucherDeactivate": {
"_id": "430751eb574c339e103d4f29",
"type": "coupon",
"id": "example",
"value": 1.23,
"originalValue": 1.23,
"redeemType": "value",
"redeemed": true,
"isInRange": true,
"singleSpending": true,
"unlimited": true,
"spendings": [
{
"orderId": "example",
"orderRef": "fe32f49be96a33ef1ffcb8d4",
"amount": 29.99,
"origin": "example",
"date": 1751779128404
}
],
"spendingLimit": 42,
"startDate": 1748479085444,
"expires": 1721699806288,
"resourcePath": "example",
"user": {
"type": "example",
"name": "example",
"email": "email@example.com",
"ref": "6e17f6ce0a2b00a48e893d02"
},
"created": 1720812713189,
"createdBy": {
"type": "example",
"name": "example",
"email": "email@example.com",
"ref": "9bdb90d8de76fe139d1790a6"
},
"note": {
"date": 1760219151329,
"content": "example"
},
"logs": [
{
"action": "example",
"description": "example",
"date": 1725876210457,
"ip": "example"
}
],
"recipients": [
{
"recipient": "example",
"date": 1733218826602
}
],
"pdf": "example"
}
}
Arguments
| Name | Type | Description |
|---|---|---|
voucherRef | ID! | Reference ID of the voucher to deactivate. |