Gift Card API

Ivan23
Tourist
8 0 2

Hey Everyone, 

I'm creating a private app for my shopify store. What I'm trying to achieve is create a gift card for a customer automatically (in a webhook). 

https://help.shopify.com/api/reference/gift_card 

Now, looks like there is no way to assign the giftcard to the customer, or I'm mistaking? 

I'm on shopify plus and already have extensive usage of the API for my store. 

Browsed this great forum for answer, but found none. 

Any help on the topic is greatly appreciated. 

From reading between the lines in the docs, it looks like I can send customer_id when creating the gift card, but if that is the case, can you guys document the gift card API documentation page better, stating all of the fields we are able to send to it?

Main issue I have currently is that Gift Card API is not working for me

I'm using PHP to make the call. Now, I wonder has anybody put the creation of gift cards to use? Looks like it's not documented right from this perpective.

First I used the documented url for creating one: 

POST/admin/gift_cards.json

But I got 404 page not found! Permissions issue? Shouldn't be, I have my private app permisions set correctly to read and write gift cards.

One more thing, is it possible to get the URL of the gift card page that is sent to the customer via gift card template? Url property exists in liquid, but does not exist in the goft card API docs.

Keep up the good work lads!

 

Replies 9 (9)
Jamie_D_
Shopify Staff (Retired)
Shopify Staff (Retired)
533 1 108

Hey Ivan,

Yes, it's possible to specify a customer_id parameter when creating a gift card in order to assign it to a specific customer. Sorry that the documentation here is a little sparse, I'll look into improving this.

A 404 error when trying the access the gift_cards.json endpoint does indeed sound like a permissions issue. You mentioned that you've already exercised the API quite a bit - if you're referring to the Gift Card endpoint, it might be that one of your API clients is blessed with access to gift_cards but not the client that you are currently testing with.

I would suggest reaching out to your Merchant Success Manager in order to make sure that the correct permissions have been provisioned on our end. 

Jamie | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Ivan23
Tourist
8 0 2

Thanks Jamie! 

That's exactly what I did too, waiting for their answer.

Jurgen_Feuchter
Shopify Partner
229 1 39

Hey Ivan, 

Right now Im having exactly the same problem with the APP Ive developed. I as well use my APP a lot and the connection between my store and the APP works fine with other endpoints. But Im getting a Not Found when I call the giftcards endpoint. Did you get an answer from your MSM? I just sent the mail to our MSM, but Im still awaiting answer. Is there a specific scope that my APP must have? Is there a specific scope for GiftCards or is it through the products_write and _read scope? Hope you have find the answer to this haha. 

Cheers! 😄

Entrepreneur, Developer, Geek, Gamer and very passionate about WEB development! 😛

Need help with your Shopify Store? Contact me: jfeuchter@gmail.com 😄
Ivan23
Tourist
8 0 2

Hey Jurgen,

 

Yep, MSM helped. She gave our private APP priviledges to giftcard_api as she told us. Even after that, it was still not working, so the problem was eleveted to the Plus engineering team. Once the support guys tested it with CURL on their end, it started working flawlessly.

Very likely priviledges need to be flushed after the MSM applied the change as well.

 

Hope you'll get it sorted out soon enough.

Ivan

Jurgen_Feuchter
Shopify Partner
229 1 39

Thanks so much for the fast answer Iván 😄 Ill ve looking into it with my msm .

 

Cheers 😄

Entrepreneur, Developer, Geek, Gamer and very passionate about WEB development! 😛

Need help with your Shopify Store? Contact me: jfeuchter@gmail.com 😄
Jurgen_Feuchter
Shopify Partner
229 1 39

Hey Ivan,

Im able to generate GiftCards now haha this seems like something they should automatically enable if you are a plus merchant haha, but oh well. I was wondering if you create GiftCards for a specific User on your shop? Or if you know if that is possible? Hope to hear from you soon 😄 

Cheers! 😛

Entrepreneur, Developer, Geek, Gamer and very passionate about WEB development! 😛

Need help with your Shopify Store? Contact me: jfeuchter@gmail.com 😄
Ivan23
Tourist
8 0 2

sure thing.

Just POST customer_id along with other gift card values and your customer will get an email with the gift card code from shopify pronto. 

 

good luck

Ivan

Jurgen_Feuchter
Shopify Partner
229 1 39

Hey Ivan,

Haha I was using user_id cause thats the property they use on the documentation. customer_id worked perfectly! 😄 Thanks so very much! 😛

Cheers! 

Entrepreneur, Developer, Geek, Gamer and very passionate about WEB development! 😛

Need help with your Shopify Store? Contact me: jfeuchter@gmail.com 😄
vishalgarg
New Member
1 0 0

Even after specifying customer_id parameter when creating gift card. In the response, customer_id value is coming as null.