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

Amit Gupta commented on Is order risk analysis information available at the time order is created in Shopify?

$
0
0

Thanks @Jamie, this is helpful. Just want to clear one more thing, you mentioned that risk information is available when the order is paid, I belive this should cover the "Authorized" payment status also. When a order is authorized, order risk information should be available.

Please correct me if I am wrong.

Thanks,


Amit Gupta commented on Partial Cancellation of Order via order cancel API.

$
0
0

Thanks Jamie, this helps. This answers first part of my question regarding partial cancellation of order. I was aware of partial fulfillment and refund. My concern is partial cancellation.

Could you please enlighten me regarding second part of my query; is parital cancellation there in your road map to implement. if yes could you please convey the time line.

Amit Gupta commented on Order risk info in Order API

$
0
0

Thanks Jamie for the confirmation.

Shopify re-send webhook message enquiry by Him

$
0
0

I'm working on Shopify integration.

Let's say I created webhook and somehow the server got internal error and response success.

Can I receive webhook message twice if already response success?

Thanks in advance.

406 - Not Acceptable error on create fulfillment request by Raj

$
0
0

I'm facing issue with fulfilling the line items. Able to download the orders so no issues on connectivity. Not able to figure out what causing the issue. Appreciate any help on this.

Code(C#)

 


            var request = (HttpWebRequest)WebRequest.Create("https://.myshopify.com/admin/orders/3956592454/fulfillments.json");
            request.Method = "PUT";
            request.ContentType = "application/json";
            request.Credentials = new NetworkCredential("", "");

            if (blogData != null)
            {
                string blog = JsonConvert.SerializeObject((blogData);
                byte[] postHeaderBytes = Encoding.UTF8.GetBytes(blog);
                request.ContentLength = postHeaderBytes.Length;
                Stream dataStream = request.GetRequestStream();
                dataStream.Write(postHeaderBytes, 0, postHeaderBytes.Length);
                dataStream.Flush();
                dataStream.Close();
            }

            HttpWebResponse response = (HttpWebResponse)request.GetResponse();

GM commented on Returning products after authenticating.

$
0
0

This only seemed to effect Chrome.  I added this:

header_remove("X-Frame-Options");

Also set the options back to what the package uses:

 

        $options = array(
            CURLOPT_RETURNTRANSFER  => TRUE,
            CURLOPT_URL             => $url,
            CURLOPT_HTTPHEADER      => $headers,
            CURLOPT_CUSTOMREQUEST   => strtoupper($request['METHOD']),
            CURLOPT_ENCODING        => '',
            CURLOPT_USERAGENT       => 'RocketCode Shopify API Wrapper',
            CURLOPT_FAILONERROR     => $request['FAILONERROR'],
            CURLOPT_VERBOSE         => $request['ALLDATA'],
            CURLOPT_HEADER          => 1
        );

 

 

This fixed it.

Spinner still loading and never ends in my public app with embedded app sdk by Yenier

$
0
0

Hi All. I'm developing a public app with the embedded app sdk and I have an issue that I can't resolve. When the app is loading the spinner never ends and the app looks like never ends because the spinner. I have included the ShopifyApp.Bar.initialize in the ShopifyApp.Bar.ready and also ShopifyApp.Bar.loadingOff() to stop de loading process but the spinner still loading. Here is my javascript code using the embeded app sdk features:

    <script src="https://cdn.shopify.com/s/assets/external/app.js"></script>
    <script type="text/javascript">
        ShopifyApp.init({
              apiKey: 'theKey',
              shopOrigin: 'https://<?php echo $_SESSION["shop"];?>',
              debug: true
        });

        ShopifyApp.ready(function(){
            ShopifyApp.Bar.initialize({
                icon: 'urlToTheIcon',
                  title: 'The App Title',
                  buttons: {
                    primary: {
                          label: 'Save',
                          message: 'save',
                          callback: function(){
                        //ShopifyApp.Bar.loadingOn();
                        //doSomeCustomAction();
                      }
                }
              }
            });
            ShopifyApp.Bar.loadingOff();
        });
          
    </script>

Also the icon doesn't load. Please, can you help me in order to fix that ??

Regards

Handling the clicking of the "decline" button when installing a paid app. by GM

$
0
0

I'm trying to handle when a user installs my app for the first time and is presented with the payment page with the two options, accept or decline.  If I click "accept" my app then continues and displays a list of products albeit in a data dump.  However if I click "decline" I get the following error:

ERROR #22: The requested URL returned error: 422 Unprocessable Entity

 This is the code that is making the call:

       $charge = $sh->call([
          'URL' => 'https://gmdevstore.myshopify.com/admin/recurring_application_charges/' . Session::get('charge_id') . '/activate.json',
          'METHOD' => 'POST',
        ], false);


       if($charge->recurring_application_charge->status == "accepted"){
               try
            {
                $call = $sh->call(['URL' => '/admin/products.json?page=1', 'METHOD' => 'GET', 'DATA' => ['limit' => 5, 'published_status' => 'any']], true);
            }
            catch (Exception $e)
            {
                $call = $e->getMessage();
            }

            echo '<pre>';
            var_dump($call);
            echo '</pre>';
       } else {
            return Redirect::to('https://apps.shopify.com/barcode/');
       }

 

The URL at is displayed on the browser at this point is and nothing appears to come back in the response:

https://dev.shopify.com/show_products?charge_id=2661380

The call that is made is:

API->call(array('URL' => 'https://gmdevstore.myshopify.com/admin/recurring_application_charges/2661380/activate.json', 'METHOD' => 'POST'), false) in routes.php line 118

 

Can anyone point me in the right direction with this?

 

Thank you,


G :)


Chen Z. commented on Creating a new refund

$
0
0

Hey Ben, 

I have the same issue regarding refunds/calculate. How did you resolve this problem? 

Refund Calculate API refund_line_items.line_item cant be blank by Chen Z.

$
0
0

Hi, 

 

I tried to calculate refunds via refunds/calculate endpoint, and i got follwing response from Shopify: 

http status: 422

array (
  'errors' =>
  array (
    'refund_line_items.line_item' =>
    array (
      0 => 'can\'t be blank',
    ),
    'refund_line_items.quantity' =>
    array (
      0 => 'cannot refund more items than were purchased',
    ),
  ),
)

Here is what i passed in as Json: 

array(
'refund' =>
  array (
    'shipping' =>
    array (
      'amount' => 1.20,
    ),
    'refund_line_items' =>
    array (
      0 =>
      array (
        'line_item_id' => 363433163,
        'quantity' => 1,
      ),
    ),
  ),
)

The request body has the same format as listed in API Doc (https://help.shopify.com/api/reference/refund#calculate). I tried to pass in line_item array, and it still gave me same error message. 

Also,I didnt even exceed the line item quantity, and it gave me "Cannot refund more items than were purchased". Any idea how to resolve this issue? Highly appreciate it. 

 

Thank you! 

Ben commented on Creating a new refund

$
0
0
//serialization

private string CalculateRefund(string orderNo, string lineItemNo, string qty, bool fullRefund)
        {

            string status = string.Empty;
            string parentId = string.Empty;
            string transactionId = string.Empty;
            string amt = string.Empty;
            string kind = string.Empty;

            //First, calculate the balance remaining to refund
            HttpWebRequest request = CreateRefundRESTRequest(orderNo, 2); //calculate endpoint

            var distinctOrderIDs = (from DataRow dr in _table.Rows
                                    select (string)dr["Order ID"]).Distinct();



            string json = JsonConvert.SerializeObject(new RootRefund
                {
                    refund = new RefundObject
                    {

                        shipping = new Shipping
                        {
                            full_refund = true
                        },

                        refund_line_items = new List<RefundLineItem>
                        {
                            new RefundLineItem
                            {
                                line_item_id = lineItemNo,
                                quantity = qty
                            }

                        }
                    }

                });


         //blah blah blah, then my RootRefund and RefundObject implementations:

public class RootRefund
{
    [JsonProperty(PropertyName = "refund")]
    public RefundObject refund { get; set; }
}

public class RefundObject
{
    [JsonProperty(PropertyName = "id")]
    public string id { get; set; }

    [JsonProperty(PropertyName = "order_id")]
    public string order_id { get; set; }

    [JsonProperty(PropertyName = "created_at")]
    public string created_at { get; set; }

    [JsonProperty(PropertyName = "note")]
    public string note { get; set; }

    [JsonProperty(PropertyName = "restock")]
    public string restock { get; set; }

    [JsonProperty(PropertyName = "notify")]
    public string notify { get; set; }

    [JsonProperty(PropertyName = "shipping")]
    public Shipping shipping { get; set; }

    [JsonProperty(PropertyName = "user_id")]
    public string user_id { get; set; }

    [JsonProperty(PropertyName = "refund_line_items")]
    public List<RefundLineItem> refund_line_items { get; set; }

    [JsonProperty(PropertyName = "transactions")]
    public List<Transaction> transactions { get; set; }

    [JsonProperty(PropertyName = "order_adjustments")]
    public List<object> order_adjustments { get; set; }
}

Hey Chen,

Make sure the JSON structure that you are serializing matches the format required by the calculate endpoint. In my case, I had to create a top-level node for this to work. So, my code looks like this (the first is just a snippet from my method to do the calculation, just to show you how this should be structured, and the second snippet is from my object class:

Ben commented on Creating a new refund

$
0
0

Sorry, my response got shoved to the bottom of my code - not sure why it did that.

Migrate orders with original order numbers by Joshua Sullivan

$
0
0

Hey everyone,

I'm working on migrating a store from a custom cart. Is it possible to create an order with the API that retains the original order number? The store has orders 150001-425000 (with gaps...153,000+ orders though). 

We tried setting the order_number field but it just seemed to ignore it. We could wack the API 150,000 times until the number is incremented to the needed value... but I hope that's not the solution. Because we're setting the source_name field, we cannot modify the order later... so we'd have to start over with a new sandbox store if we mess up.

Hope there is something we can do.

Thanks,

Joshua

Taylor Romero commented on ShopifyPOS.setLineItemDiscount bug

Andy Hanson-Dvoracek commented on Webhook HMAC verification passing on Test Notifications but not on real transactions

$
0
0

I'm also encountering this problem, however I'm already using the UTF8 encoding.

private bool VerifyWebhook(string message, string verify)
{
    string keyString = Helper.GetAppSetting("shopifyWebhookVerification", string.Empty);
    byte[] keyBytes = Encoding.UTF8.GetBytes(keyString);
    byte[] dataBytes = Encoding.UTF8.GetBytes(message);

    HMACSHA256 hmac = new System.Security.Cryptography.HMACSHA256(keyBytes);
    byte[] hmacBytes = hmac.ComputeHash(dataBytes);
    string hmacString = Convert.ToBase64String(hmacBytes);

    return hmacString == verify;
}

Am I missing something? Maybe related to how I'm converting the request body from a Stream to a string?


Chen Z. commented on Creating a new refund

$
0
0

Thank you so much. I double checked my json string structure, and it has right format. Then i found out that I used product_id as lint_item_id, which was totally wrong. 

Can't update "Price" through Shopify API python script by Michael S

$
0
0

Hi All,

I have a problem updating the price through the API. I'm pasting my python script below. May someone let me know what I'm doing wrong?

There is no response from the script, however I'm quite sure it connects successfully to the API. The API key, PASSWORD and DOMAIN name was  changed just before pasting. The product ID is an existing product ID. Please help.

 

import shopify


API_KEY="myAPIkey"
PASSWORD="password"


shop_url = "https://%s:%s@mydomain.myshopify.com/admin" % (API_KEY, PASSWORD)
shopify.ShopifyResource.set_site(shop_url)

#shop = shopify.Shop.current()
product=shopify.Product.find(8139203079)
product.price = "9999"
product.save()
 

HunkyBill commented on Can't update "Price" through Shopify API python script

$
0
0

Simple enough. Products do not have prices in Shopify. However, products do have variants, and it is that, the variant that you want to update. So in your code, you get a product. Now iterate the variants, and set prices. When done, save the product and lo-and-behold the glory. Success.

File Listing In Admin. by Brian Rogers

$
0
0

When listing image files using a filter such as "LB" for files such as LB100.jpg - LB1600.jpg, many file names are missing. thi bug prevents me from updating image files. I thought I deleted all the "LB" files, but in fact the search function does not work properly.

Jetblackstar commented on How to add your app to Shopify Admin Menus?

$
0
0

Ugh, its a really nice feature for published apps. 

You basically use your developers login to define where you want the buttons and any params that are available. I just can't do that for a private non published app.

I just want a client to be able to be in a product and click my button which sends them to my app (with the ID of the product). 

Thanks for replying, at least it increases this thread being spotted by a dev. :P

 

Viewing all 25503 articles
Browse latest View live


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