I hit a roadblock creating a plugin to send gift cards to other people.

I hit a roadblock creating a plugin to send gift cards to other people.

MGMonge
Shopify Partner
7 0 13

Hello, Shopify community,

I've been working on an app to allow sending gift cards by email to someone else and also schedule them to a specific date. I got very close until a hit a roadblock.

The functionality is pretty simple, on the admin side you can select the gift card product you want to have this functionality.

Then on the front store side, you'll see an extra button below "add to cart" called "send as a gift", this opens a modal and allow you to input the recipient information + the option to schedule it if you wish.

Then I'm listening to the order-paid webhook to detect when my gift card product is purchased. So far so good, but then I hit the roadblock. I realized there is no way to get the generated gift card resource from the order.

- There is no webhook to listen to when a gift card is generated. (At least I couldn't find any on the documentation)
- Even if you have the gift card endpoints enabled, you have no endpoint to find gift cards by order id or cart id (at least I couldn't find one on the documentation)
- Even if you have an endpoint to retrieve the generated gift card by order id or cart id you wouldn't be able to access the gift card code (according to the documentation), so you wouldn't be able to email it to someone else. 

The solution I found is ugly and it needs the gift cards endpoints enabled which is to create a new gift card when the order is purchased but that will keep the previously generated gift card also active :S

So I need some help and I have 2 questions:

1) Is there a better way to achieve this? Am I missing something?

2) Do I really need to enable the gift cards endpoints to achieve this? Ideally, I would like to send the same email you get when you buy the gift card for yourself, but for the recipient so I'm not even interested in the gift card resource if I can do that some other way. 

If there is a solution without having to make a custom app and activate the gift card endpoints would be even better, because I would like my plugin to be installed in many stores, but if this is not possible it will also help make a custom app because I have one merchant that needs this app.

I hope it's all clear

Thank you so much in advance

Maximiliano 

Replies 0 (0)