redeemGiftCardBalanceAsStoreCredit mutation
Magento Commerce only
The content on this page is for Magento Commerce only.
Learn more
The redeemGiftCardBalanceAsStoreCredit
mutation converts the entire balance of a gift card to store credit. The gift card must be redeemable and cannot have a balance of 0 at the time you run the mutation. After successfully running the mutation, the value of the gift card changes to 0.
Run this mutation on behalf of logged-in customers only. Authorization tokens describes how to send a request as a customer.
Syntax
mutation: redeemGiftCardBalanceAsStoreCredit(input: GiftCardAccountInput): GiftCardAccount
Example usage
The following example redeems the gift card with code ā056MHP57TJ5Cā
.
Request:
1
2
3
4
5
6
7
8
9
10
11
12
mutation {
redeemGiftCardBalanceAsStoreCredit(
input : { gift_card_code: ā056MHP57TJ5Cā}
) {
balance {
currency
value
}
code
expiration_date
}
}
Response:
1
2
3
4
5
6
7
8
9
10
11
12
{
"data": {
"redeemGiftCardBalanceAsStoreCredit": {
"balance": {
"currency": "USD",
"value": 0
},
"code": "056MHP57TJ5C",
"expiration_date": null
}
}
}
Input attributes
GiftCardAccountInput object
The GiftCardAccountInput
object must contain the following attribute:
Attribute | Data Type | Description |
---|---|---|
gift_card_code |
String! | The gift card code |
Output attributes
The GiftCardAccount
object contains the following attributes:
Attribute | Data Type | Description |
---|---|---|
balance |
Money | The remaining balance of the gift card, including the currency |
code |
String | The gift card code |
expiration_date |
String | The date when the gift card expires, if any |