Re: Can Shopify API be used to update gift card balance?

Can Shopify API be used to update gift card balance?

nuthon
Visitor
3 0 1

Hi,

 

Is there a way to use Shopify API to update the balance of a gift card?

 

Looking at the documentation , I can't see any thing related updating the balance.

 

https://shopify.dev/docs/api/admin-rest/2023-10/resources/gift-card

Replies 4 (4)

StephensWorld
Shopify Partner
1400 174 377

It should be possible to do, as "balance" is one of the properties that can be used. 

 

gift card API.png

 

The "PUT" function allows for updating existing gift cards. 

 

https://shopify.dev/docs/api/admin-rest/2023-10/resources/gift-card#put-gift-cards-gift-card-id 

 

How to actually make this work though will require input from someone who has more experience with APIs than I do though. 

★ Did my post help? If yes, then please like and accept solution. ★

https://stephens.world
support@stephensworld.ca

vicvans20
Shopify Partner
14 1 11

There used to be a section about adjusting the balance of the gift card but it seems is no longer documented, the endpoint still works and I haven't seen anything about it being deprecated in the soon future.

 

Here is an example:

Endpoint: "https://yourstore.myshopify.com/admin/api/2024-01/gift_cards/{GIFT_CARD_ID}/adjustments.json"

JSON:

{
  "adjustment": {
    "amount": -6440,
    "gift_card_id": 501700100192,
    "note": "Filling",
    "remote_transaction_ref": "xxx"
  }
}

 The adjustment appears in the Shopify Admin Gift Card screen.

 

NOTE: You need to enable some scopes to access this API:

Screenshot_20240304_111358.png

 

Hope it helps!

pipcad
Shopify Partner
1 0 1

Posting this for anyone else who might need this: 

 

For some reason the resource documentation appears to be hidden from the side menu of the shopify dev docs. Here is the link to the docs: https://shopify.dev/docs/api/admin-rest/2024-04/resources/gift-card-adjustment 

 

Also, you need to go into the settings and create the app, then contact Support and ask them to add the scopes write/read_giftcard_adjustments scopes to the app you created.

 

 

brdata
Shopify Partner
54 2 14

As of GraphQL API version 2024-10, you can update the gift card balance using giftCardCredit and giftCardDebit.

 

Requires write_gift_card_transactions access scope.

 

giftCardCredit - GraphQL Admin

 

giftCardDebit - GraphQL Admin