Hi guys!
I'm trying to accomplish this: Programatic fulfillment of orders in my Ruby on Rails backend
How am I doing it:
- Created a new Shopify's App and got my API keys
- I'm using Mechanize lib to accomplish that - http://mechanize.rubyforge.org/
- Code being used:
begin
require 'mechanize'@browser = Mechanize.new
@browser.auth('XXX', 'XXX')
@payload = {
"fulfillment" => {
"notify_customer" => true,
"tracking_number" => Time.now.to_i.to_s
}
}@browser.post("https://buy-fifa-ultimate-team-coins.myshopify.com/admin/orders/#{self.order_id}/fulfillments.json", @payload)
rescue Exception => e
Delayed::Worker.logger.debug e.message
Delayed::Worker.logger.debug e.backtrace.inspect
end
Error being logged:
Mechanize::ResponseCodeError: 400 => Net::HTTPBadRequest for https://buy-fifa-ultimate-team-coins.myshopify.com/admin/orders/235914041/fulfillments.json -- unhandled response
Need help figuring out what is causing the 400 response! =)
Thanks to all