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": "896369509846c0d49814f46c"
}

Response

{
"voucherDeactivate": {
"_id": "2c97b447bac0e3a5fa0eb632",
"type": "coupon",
"id": "example",
"value": 1.23,
"originalValue": 1.23,
"redeemType": "value",
"redeemed": true,
"isInRange": true,
"singleSpending": true,
"unlimited": true,
"spendings": [
{
"orderId": "example",
"orderRef": "becf92a3c70d658d7d2990ae",
"amount": 29.99,
"origin": "example",
"date": 1752929618413
}
],
"spendingLimit": 42,
"startDate": 1762003548371,
"expires": 1762016901504,
"resourcePath": "example",
"user": {
"type": "example",
"name": "example",
"email": "email@example.com",
"ref": "dadc90804623031af1e0899b"
},
"created": 1707690036838,
"createdBy": {
"type": "example",
"name": "example",
"email": "email@example.com",
"ref": "c80c152b507c017838274128"
},
"note": {
"date": 1725015232026,
"content": "example"
},
"logs": [
{
"action": "example",
"description": "example",
"date": 1712391016994,
"ip": "example"
}
],
"recipients": [
{
"recipient": "example",
"date": 1733811732722
}
],
"pdf": "example"
}
}

Arguments

NameTypeDescription
voucherRefID!Reference ID of the voucher to deactivate.

Returns

Voucher