shoutem / react-native-shopify

React Native bridge to Shopify Buy SDK

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Getting an error when trying to add items to checkout

sduval215 opened this issue · comments

Hey there! Great library. I'm getting this error when trying to add items to my cart.

screen shot 2018-09-25 at 12 48 04 pm

sduval215, did you figure out a solution? I'm stuck on this too.

@sduval215 , same issue - did you find a solution? or @thelight413 ?

Thanks!

@jayhack, I was adding the line items incorrectly.Add this code before initializing graphClient in RNShopifyModule.java file

HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
   logging.setLevel(HttpLoggingInterceptor.Level.BODY);
   OkHttpClient client = new OkHttpClient.Builder()
           .addInterceptor(logging)
           .build();

And you will see request and response raw data in LogCat. It will give you the actual error you are getting from Shopify.

In case anyone else comes across this I thought I'd post what my problem was. I was using a deprecated version of the mobile buy sdk:

pod "Mobile-Buy-SDK", '~> 2.0'

I added some logging to the Obj-C files and got this:

Domain=BUYShopifyErrorDomain Code=412 "(null)" UserInfo={errors={
    "version_date" =     (
                {
            code = blank;
            message = "can't be blank";
            options =             {
            };
        }
    );

Mentioned here: Shopify/mobile-buy-sdk-ios#857

The problem is when you upgrade to the latest, you'll come across the errors mentioned in #41 and #31, which is ultimately why I was using the deprecated version in the first place. I'm not sure of the fix but I'm going to follow the thread in #41 as it appears @ConSou might know what to do!

cc: @jayhack, @sduval215