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": "927f9669b0faa35d6e2f1853"
}
Response
{
"voucherDeactivate": {
"_id": "2a4f882851ee421d6b40bca0",
"type": "coupon",
"id": "example",
"value": 1.23,
"originalValue": 1.23,
"redeemType": "value",
"redeemed": true,
"isInRange": true,
"singleSpending": true,
"unlimited": true,
"spendings": [
{
"orderId": "example",
"orderRef": "6e1f3db92abb4198df05f35a",
"amount": 29.99,
"origin": "example",
"date": 1712822038358
}
],
"spendingLimit": 42,
"startDate": 1710256204462,
"expires": 1758130738266,
"resourcePath": "example",
"user": {
"type": "example",
"name": "example",
"email": "email@example.com",
"ref": "dc4c4d6bcb6a9bcd6619f9b6"
},
"created": 1715594652579,
"createdBy": {
"type": "example",
"name": "example",
"email": "email@example.com",
"ref": "31376967f7a5baacbd6e54e2"
},
"note": {
"date": 1765993237070,
"content": "example"
},
"logs": [
{
"action": "example",
"description": "example",
"date": 1732500924513,
"ip": "example"
}
],
"recipients": [
{
"recipient": "example",
"date": 1763965667900
}
],
"pdf": "example"
}
}
Arguments
| Name | Type | Description |
|---|---|---|
voucherRef | ID! | Reference ID of the voucher to deactivate. |