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": "f0a841e3dfdd4221ab62ed2e"
}

Response

{
"voucherDeactivate": {
"_id": "d494a0714c22b02b06302f49",
"type": "coupon",
"id": "example",
"value": 1.23,
"originalValue": 1.23,
"redeemType": "value",
"redeemed": true,
"isInRange": true,
"singleSpending": true,
"unlimited": true,
"spendings": [
{
"orderId": "example",
"orderRef": "ef9f15d758f76cce57b5a4f2",
"amount": 29.99,
"origin": "example",
"date": 1764535589155
}
],
"spendingLimit": 42,
"startDate": 1722519793224,
"expires": 1723609851361,
"resourcePath": "example",
"user": {
"type": "example",
"name": "example",
"email": "email@example.com",
"ref": "19d0037546b88adc701ed52f"
},
"created": 1751661922327,
"createdBy": {
"type": "example",
"name": "example",
"email": "email@example.com",
"ref": "3cfd2fd2099618f20e36d741"
},
"note": {
"date": 1764836790086,
"content": "example"
},
"logs": [
{
"action": "example",
"description": "example",
"date": 1727358233486,
"ip": "example"
}
],
"recipients": [
{
"recipient": "example",
"date": 1712543125410
}
],
"pdf": "example"
}
}

Arguments

NameTypeDescription
voucherRefID!Reference ID of the voucher to deactivate.

Returns

Voucher