Quantcast
Channel: Opinion: Shopify Community - Shopify APIs & SDKs
Viewing all articles
Browse latest Browse all 25503

gift card fulfillment with shopify Order api by HTee

$
0
0

I am making a private app. I want to automatically generate a gift card with the ShopifyAPI::Order. I created a new order with the gift card product + variant as the line item and the gift_card as fulfillment_service. I am using the developer account with the gift card plan.

The following code is what I typed into the shopify console

order = ShopifyAPI::Order.new(:line_items => [ShopifyAPI::LineItem.new("fulfillment_service"=>"gift_card", "fulfillment_status"=>"fulfilled", "price"=>"10.00", "product_id"=>233702101, "quantity"=>1, "requires_shipping"=>false, "sku"=>"", "title"=>"Gift Card", "variant_id"=>528500937, "variant_title"=>"$10.00", "vendor"=>"ExampleDev", "name"=>"Gift Card - $10.00", "variant_inventory_management"=>nil)], :email => 'example@domain.com', :financial_status => 'paid', :customer => ShopifyAPI::Customer.first, :shipping_address => ShopifyAPI::Customer.first.default_address)

order.save

 

My order history shows:

Received new order 
We submitted 1 line item for fulfillment to external service 
Order was placed 
Shipping Address has been updated 

The order was generated but the gift card was not fulfilled. 
How can I get it to trigger the gift_card fulfillment like the following?

1 gift card was sent 
1 gift card is scheduled for delivery 


Viewing all articles
Browse latest Browse all 25503

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>