Order is not shown with 0 value

pank
New Member
5 0 0

Hello Support,

I have integrated Shopify web service in our portal. I am placing an order from web service to Shopify admin. I am following this service https://help.shopify.com/api/reference/order#create

When I set price "0" with an order that order is not posted on Shopify portal.

Could you please let me know how to send orders on Shopify which has "0" price value. As I have to keep private that value from my web service to Shopify partner portal.

Looking forward to hearing from you soon.

Thanks

 

 

0 Likes
Alex
Shopify Staff
Shopify Staff
1555 81 306

Hey there.

I cannot replicate this, can you give more information such as what your request looks like, a request-id, and the response you're getting?

Cheers.

0 Likes
pank
New Member
5 0 0

Hi

Following are my request for that. If I set price , amout and tax as "0' value then its not post on admin store. If i set with postive number then it will post on shopify store.

$ch = curl_init("https://".$api_key.":".$api_pass."@".$api_url."/orders.json");
    $order = array('order' => array(
        'line_items' => array(
            array(
                'title' => $orderList->gname,
                'price' => 0,
                'quantity' => 1
            )
        ),
        'customer' => array(
            'first_name' => $orderList->firstname,
            'last_name' => $orderList->lastname,
            'email' => ($orderList->username == '' ? $orderList->fbEmail :  $orderList->username)
        ),
        'billing_address' => array (
            'first_name' => $orderList->name,
            'address1' => $orderList->address1,
            'address2' => $orderList->address2,
            'phone' => $orderList->phone,
            'city' => $orderList->city,
            'province' => $orderList->provience,
            'country' => $orderList->country,
            'zip' => $orderList->postal,
            'default' => true
        ),
        'shipping_address' => array (
            'first_name' => $orderList->name,
            'address1' => $orderList->address1,
            'address2' => $orderList->address2,
            'phone' => $orderList->phone,
            'city' => $orderList->city,
            'province' => $orderList->provience,
            'country' => $orderList->country,
            'zip' => $orderList->postal,
            'default' => true
        ),
        'transactions' => array(
            array(
                'status' => 'success',
                'amount' => 0
            )
        ),
        'total_tax' => 0,
        'currency' => $orderList->currency,
        'note' => $orderList->description
    ));

0 Likes
Alex
Shopify Staff
Shopify Staff
1555 81 306

Are you logging your HTTP responses? I'm not a PHP developer, so I can't speak to how correct your code is. Can you replicate this using curl in the command line or an HTTP client like Postman?

0 Likes
pank
New Member
5 0 0

Hi

I am testing my webservice call by Postmen. And below are my sample code.

Hi

Following are my request for that. If I set price , amout and tax as "0' value then its not post on admin store. If i set with postive number then it will post on shopify store.

$ch = curl_init("https://".$api_key.":".$api_pass."@".$api_url."/orders.json");
    $order = array('order' => array(
        'line_items' => array(
            array(
                'title' => $orderList->gname,
                'price' => 0,
                'quantity' => 1
            )
        ),

 

Here you can see price is "0" and when we post our order on shopify that order is not send on shopify due to that 0 price. If we set greater price than 0 that order will send to shoppify.

below error we are getting.

stdClass Object ( [errors] => Array ( [transactions] => Array ( [0] => Amount must be greater than zero for sale transactions ) [order] => Array ( [0] => Transactions is invalid ) ) )

0 Likes
Alex
Shopify Staff
Shopify Staff
1555 81 306

It's interesting to me that you're failing a transaction validation when you are not making use of a transaction object from what I can tell. Can you provide me with a time frame and the x-request-id returned in your response (as a header)?

0 Likes
jhersey29
New Member
1 0 0

I have found dropping the transaction or setting it to an empty array and adding a coupon for 100% seems to work if you are trying to generate a 0.  Not sure of the implications yet but hoping it's a step in the correct direction.  I am trying to create a 0.00 value order for when we send replacements for broken or damaged goods at no cost to the customer.  Trial and error since I can't find any documentation related to my process.

 

{
"order": {
"line_items": [
{
"variant_id": "10308822900923",
"quantity": "1"
},
{
"variant_id": "10308830896315",
"quantity": "1"
}
],
"email": null,
"phone": null,
"billing_address": {
"first_name": "test",
"last_name": "test",
"address1": "Test St.",
"address2": "",
"company": null,
"phone": null,
"city": "test city",
"province": "test state",
"country": "United States",
"zip": "12345"
},
"shipping_address": {
"first_name": "",
"last_name": "test",
"address1": "Test St.",
"address2": "",
"company": "",
"phone": null,
"city": "test city",
"province": "test state",
"country": "United States",
"zip": "12345"
},
"transactions": [],
"financial_status": "paid",
"discount_codes": [
{
"code": "RESEND",
"amount": 100,
"type": "percentage"
}
],
"send_receipt": true,
"inventory_behaviour": "bypass",
"send_fulfillment_receipt": false
}
}

 

0 Likes