API Error Code 1383146 in Facebook Canvas API for Unity while making payment
Asked Answered
F

3

6

I have implemented payments in my Unity app and have defined products in HTML form in my server, and have crawled them with FB's debug tool. The products are identical to Facebook's payments example apart from pricing and naming, as well as the photo link.

Yet, when I run FB.Canvas.Buy after deploying the app to Canvas, I get the following error:

An error occurred. Please try again later.
API Error Code: 1383146
API Error Description: invalid og type. Expected og:product, got website

This error has no documentation I can seem to find on any search engine or on Facebook's own documentation.

Any help would be appreciated, thank you.

Fronde answered 7/12, 2014 at 12:36 Comment(1)
Need more code to see how you update the data.Finding
F
1

I found the problem was I was passing the actual URL of the HTML product into the pay dialog rather than the graph object ID.

When using the graph object ID, I am finally able to perform purchases.

Fronde answered 11/12, 2014 at 7:53 Comment(0)
G
1

I meet the same error code 1383146 and found the root cause. In the beginning i expect the product URL will be my current URL plus product.html. For example. My page is https://a.b.c/def/ and i expect FB to parse my product page https://a.b.c/def/product.html

    var productURL = window.location.href + 'product.html';

    var obj = {
      method: 'pay',
      action: 'purchaseitem',
      product: productURL
    };

    FB.ui(obj, function(data) {
      ...
    });

But i found FB will add query string when POST to my canvas page URL in some cases. URL will become https://a.b.c/def/?fb_source=search&ref=ts&fref=ts. Then my code will be wrong because i use window.location.href. So i update code and never meet 1383146 issue.

    var productURL = window.location.protocol + "//" + window.location.host + window.location.pathname + 'product.html';

    var obj = {
      method: 'pay',
      action: 'purchaseitem',
      product: productURL
    };

    FB.ui(obj, function(data) {
      ...
    });
Gershwin answered 2/7, 2015 at 2:57 Comment(0)
E
0

In my case, the Facebook scraper could not reach the web server that is hosting the products (it could only be reached from our office, which I did not know). In that case, Facebook constructs a default object of type website and then complains about that.

You can see this in action with the Facebook Sharing Debugger. Enter your product URL, and hit the 'Debug' and maybe 'Scrape Again' buttons. It will show 'Warnings That Should Be Fixed'. It will only show the first warning by default, make sure you show all warnings. For me, one of those warnings further down was 'Cannot Connect To Server'. So that was the REAL problem

Evanevander answered 20/7, 2016 at 16:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.