Add gift card transaction on an order

rishikesharya
New Member
3 0 1

How can I add a gift card on order through admin API?

I am creating orders at the backend and adding a gift cards as transactions. I am adding the below object in order transactions JSON

{
kind : "sale",
status : "success",
amount : 171.0,
gateway : "gift_card",
gift_card_id: 12344333,
receipt : {
gift_card_id : 12344333,
gift_card_last_characters: ngj3
}
}

The transaction is getting added but the amount from the gift card is not getting debited. 
0 Likes
GrahamS
Shopify Staff
Shopify Staff
130 19 25

Hello @rishikesharya ,

It would be more accurate to think of the transactions API as a way of creating a record of a payment processing task that was committed elsewhere or at another time. Creating a transaction record, regardless of the details included within, would not cause any kind of payment charge to occur, gift card, credit card, or otherwise. This is why creating a transaction record with valid gift card details does not actually action a payment processing task to occur - it's not meant to happen that way.

Gift cards are essentially the same as Credit cards, as far as internal processing is concerned. In order to charge one via API, you would need to have your app configured as a sales channel.

Graham S | API Support @ 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 Shopify.dev or the Shopify Web Design and Development Blog

0 Likes