Gorgias logo
Gorgias logo

All articles

Create gift card in ShopifyUpdated 4 months ago

This option is available only if you are on Shopify Plus.

You can use Macros to create custom gift card codes and set their value directly from Gorgias.


Install the developer app in Shopify

1. In Shopify, navigate to Settings -> Apps and sales channels -> Develop apps.

2. Click on Create an app (or first allow the development of apps on your store, if you haven't before).

3. Enter a name for the gift card and select who developed it.4. Click Configure Admin API scopes.

5. Under Discounts, Gift cards, and Price rules, tick both read and write permissions.6. Click Save in the bottom right.

7. Click Install app in the top right and you'll be shown your API credentials.

8. Click Reveal token once and make sure not to close the tab/page.

Never reveal your API token to anyone else - including our Support team.

9. In a new tab, open an API converter.

10. Paste the API key and token into the username and password fields, taking note of the : between each.

11. Click generate to convert to API key/token to Base64 format.

Create a Macro in Gorgias

Macros that have any kind of Shopify/ReCharge/webhook action included can't be used inside Rules - they won't show on the list under the Apply Macro Action when creating a Rule.

1. In Gorgias navigate to Settings -> Productivity -> Macros.

2. Click on Create macro in the top right.

3. Enter generic Macro details - name, language, Tags, etc.

4. Write your response and be sure to include the gift card code - this must match the code field in the body script: 


5. Click Add action -> External actions -> HTTP Hook.

6. Configure a POST call with the below parameters, noting the store and authentication will be unique to you.

TitleAdd a Shopify gift card $10
Body { "gift_card": {
        "code": "{{ticket.customer.integrations.shopify.customer.first_name}}{{ticket.id}}10GC",
        "note": "Created by Gorgias for customer {{ticket.customer.email}}",
        "initial_value": 10,
        "template_suffix": "gift_cards.birthday.liquid"

7. Click Create Macro.

Action status

When using this Macro, there are 2 potential outcome statuses: successful or failed

If an Action fails, the message won't be sent and agents are given the option to retry, send the message without the Action, or cancel. Failure occurs if there's an error, permission changes, or if Gorgias/Shopify times out, but these instances are rare. 

As the code generated uses the ticket ID, this Macro can be used successfully once per ticket. 

Was this article helpful?