POST Transaction in shopify -


i doing create transaction below code

$dataem  = array('transactions'=>array('kind'=>'sale','status'=>'success')); $urls = 'https://'.'xxxxxxxxxxxxxxxxx'.':'.'xxxxxxxxxxxxxxxxxxxxx'.'@storename.myshopify.com/admin/orders/xxxxxxxid/transactions.json';  $data_string = json_encode($dataem);  $headers = array( "content-type: application/json", "accept: application/json", "content-length:" . strlen($data_string));  $handler = curl_init($urls); curl_setopt($handler, curlopt_customrequest, "post"); curl_setopt($handler, curlopt_postfields, $data_string); curl_setopt($handler, curlopt_returntransfer, true); curl_setopt($handler, curlopt_httpheader, $headers); $responses = curl_exec($handler); echo "<pre>"; print_r($responses); 

and shows result {"errors":{"transaction":"required parameter missing or invalid"}}

see shopify api docs creating transaction here:

post /admin/orders/#{id}/transactions.json {        "transaction": {         "kind": "capture"     } } 

you've got 'transactions' instead of 'transaction'. also, status returned in response, shouldn't specify in request.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -