Import an order that was paid for with a gift card

Steve_Robbins
Shopify Partner
11 0 1

I'm working on a sales channel app.  I'm trying to create an order that was paid for, or partially paid for, with a gift card.

 

I'm using the admin api to create an order, but there's no option to attach a gift card to the order as a payment method.

 

This is causing problem because Shopify is not honoring the `payment_due` that I'm setting specifying, because it's doing it's own math on based on the line items in the order.

 

My request looks something like

 

POST /admin/orders.json
{ "order": { "billing_address": { ... }, "currency": "EUR", "gift_cards": [ { "amount_used": "10.00", "balance": "10.00", "id": 59637760089, "last_characters": "8275" } ], "line_items": [ { "line_price": 12, "price": 12, "product_id": 1731712974899, "quantity": 1, "requires_shipping": true, "taxable": true, "variant_id": 17169845059635, } ], "payment_due": 2.87, "requires_shipping": true, "shipping_address": { ... }, "tax_lines": [ { "compare_at": "0.0725", "price": 0.87, "rate": "0.0725", "title": "CA State Tax" } ], "total_line_items_price": 12, "total_price": 2.87, "total_tax": 0.87, "shipping_lines": [ { "handle": "shopify-Free%20Shipping-0.00", "price": 0, "title": "Free Shipping" } ], "test": true, "inventory_behaviour": "decrement_obeying_policy", "transactions": [ { "kind": "sale", "status": "success", "amount": 2.87 } ] } }

You can see the $12 item, $0.87 in tax, $0 in shipping, gives a subtotal of $12.87.  I'm using a $10 gift card, so the final total I'm trying to import is $2.87.

 

But when I check on the created order in the Shopify admin it's $12.87, and there's no mention of a gift card being used.

 

I don't see anything in the Admin API for specifying a used gift card on the order object, I'm just specifying it as `gift_cards` because that's how the checkout API takes it.

 

Another problem is that this gift card goes un-redeemed.  The customer can use it an infinite amount of times.

 

How can I make sure the imported order has the correct total less the gift card used?  How can I represent a gift card was used on this order and empty the balance of the gift card?

Reply 1 (1)

hassain
Shopify Staff (Retired)
624 104 187

Hey @Steve_Robbins ,

 

As it currently stands, there is no way to create Orders or Draft Orders that are paid for by Gift Cards via the Shopify Admin API. 

 

The only workaround here that I can see would be to use the API instead to create a checkout for the items in that order (which would require your Sales Channel to request for payment processing https://shopify.dev/tutorials/build-a-sales-channel#request-payment-processing) and then use the specific Gift Card to pay for that order.

 

To learn more visit the Shopify Help Center or the Community Blog.