Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Gift Card API access from Theme App Extension

Gift Card API access from Theme App Extension

_chrisdim
Shopify Partner
1 0 0

Hey folks,

 

Is it possible to access the Gift Card API from a Theme App Extension?

 

I'm looking for a way to build a simple form where a customer can check their own gift card balance, but I can't seem to find a way to access the Gift Card API from a Theme App Extension.

Reply 1 (1)

EcomGraduates
Shopify Partner
862 71 126

Hello there  

Yes, it is possible to access the Gift Card API from a Theme App Extension on Shopify. The Gift Card API allows you to create and manage gift cards for your store, and can be accessed using the same process as any other Shopify API.

To access the Gift Card API from a Theme App Extension, you will need to follow these steps:

 

 

  1. First, you will need to create a new custom app in your Shopify store's admin panel. To do this, go to "Apps" in the left-hand menu, and then click on the "Create app" button.
  2. Follow the prompts to create a new custom app and obtain an API key and API password. These will be used to authenticate your API calls to the Shopify API.
  3. In your Theme App Extension code, you can use the Shopify API client library for the programming language you are using to make API calls to your store. For example, if you are using Node.js, you can use the shopify-api-node library.
  4. To access the Gift Card API, you can use the GET /admin/api/2020-04/gift_cards.json, POST /admin/api/2020-04/gift_cards.json, GET /admin/api/2020-04/gift_cards/{id}.json, and other related endpoints. These endpoints allow you to retrieve, create, and manage gift cards for your store.
  5. In your Theme App Extension code, you can use the API client library to make the appropriate API request and pass in the necessary authentication credentials (API key and password) and any necessary parameters or payloads. The API will then return the requested data or perform the requested action.

hope this helps!

 Like + accept if this helped |
 Theme: EcomifyTheme |
️ Get An Audit: Here