Facebook Error Canvas API 1383146 for Unity when making a payment

I implemented payments in my Unity application and defined products in HTML form on my server and crawled them using the FB debugging tool. The products are identical to the Facebook payment examples, in addition to pricing and naming, as well as links to photos.

However, when I run FB.Canvas.Buy after deploying the application 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 does not have the documentation that I can find on any search engine or in my own Facebook documentation.

Any help would be appreciated, thanks.

+6
source share
3 answers

I found that the problem was transferring the actual URL of the HTML product in the payment dialog, and not in the object identifier . .

By using the ID of the chart object, I can finally make purchases.

+1
source

I meet the same error code 1383146 and found the reason. In the beginning, I expect the product URL to be my current URL plus product.html . For instance. My page is https: // abc / def / , and I expect FB to parse my product page https: //abc/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 that FB will add a query string when POST to my canvas page URL in some cases. The URL will become https: // abc / def /? Fb_source = search & ref = ts & fref = ts . Then my code will be wrong, because I use window.location.href . Therefore, I am updating the code and never encountering issue 1383146.

  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) { ... }); 
+1
source

In my case, the Facebook scraper could not get to the web server that hosts the products (it could only be obtained from our office, which I did not know). In this case, Facebook builds a default type object for the type, and then complains about it.

You can see this in action using the Facebook Posting Divider. Enter the URL of your product and click the Debug and Scrap Repeat buttons. It will show "Warnings that need to be fixed." It will only show the first warning by default, make sure you show all warnings. For me, one of these warnings further is "I can not connect to the server." So it was a REAL problem

0
source

Source: https://habr.com/ru/post/979240/


All Articles