Topics covering webhook creation & management, event handling, Pub/Sub, and Eventbridge, in Shopify apps.
Hi,
Going through the list of webhook events it is not clear which webhook event should we subscribe to, to get notifications when a new gift card is purchased through the shopify store. Since gift card is a product in Shopify we thought orders/paid event would be the right one. But it is not triggered for a new gift card.
I believe for redemption we can susbcribe to orders/paid event and check for flag "gift_card": true and then get the gift card info.
Any guidance here would be appreciated. Thanks!
Hey @pintuna
There is currently no specific webhook that is triggered when a gift card is purchased or issued. As a workaround, you could subscribe to the orders/create
or orders/paid
webhook and then check the line items of the order, but this will only trigger if the gift card is purchased through the Online Store (not issued via the admin).
As for the gift card redemption, you're correct. You can subscribe to the orders/paid
event and check for the "gift_card" flag to identify when a gift card has been used for payment.
Also check out the Gift Card API if you're on a Plus store.
Scott | Developer Advocate @ Shopify
Thanks @sbd
We are able to identify both gift card purchased and redeemed events using the orders/paid webhook.
But have the following questions -
1. For a new gift card is there a way to capture the gift card code?
2. For redemption, in the webhook we can see that a gift card was used for payment but is there a way to find out which gift card was used and how much was redeemed?
Hey @pintuna
1. Codes are only visible if the card is created via the API, otherwise you'll only be able to see the last four digits.
2. Today I learned - this doesn't appear to be possible. You could monitor the transactions using the Transactions API (as every time a gift card is used, it's recorded as a transaction of kind "gift_card"), however, only the gift card's last four digits are exposed, not the full gift card ID.
Scott | Developer Advocate @ Shopify