API Error Code 1383146 in Facebook Canvas API for Unity while making payment - facebook

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.

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.

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

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

Related

Facebook payment returns error code 200 with status "Request aborted"

I have an app on facebook which users buy credits to play in a game.
For some reason when I make the call to facebook API like this:
var obj =
{
method: 'pay',
action: 'purchaseitem',
product: product URI
request_id: requestID
};
FB.ui(obj, function (data) {
...
});
In the callback function I get data object which contains:
data.error_code = '200';
data.error_message = 'Request aborted'
Anyone can please advise why is this happening?
I know this is old, but if someone still needs an answer, I believe that the issue is related to the fact that the end users are double-clicking the button, hence creating a call to another Ajax request and therefor the first request is being aborted.
Cheers!
If fast or accidental double clicks are an issue due to performance or user end error perhaps we need to try to use javascript to remove button from DOM on user click removing any chance of the error.

Facebook Payments - Error Code : 1383008 . The app you're using is not responding

We're moving from the old facebook payments method (which involved FB credits) to the new local currency system. We're using dynamic pricing.
var obj = {
method: 'pay',
action: 'purchaseitem',
product: 'produrl.php',
quantity: 1,
};
FB.ui(obj, FBCcallback);
(Is defining purchaseitem action is "required" or mandatory)
The product url has been scraped and it does give the required results in the debug tool. The callback url is also tested and is working. Yet the error persists. Someone suggested that we leave it over night, that didn't work out either.
Any ideas?
One of the reasons why Facebook would consider the server callback to be not responsive is if the server script caused an error. So if you're using PHP and you get this error, check your error log or use Facebook's sample script for testing.
If the sample works, then there's definitely an error in your PHP script.

Facebook API Error 100 'link' is invalid

I have my site qa.carryon.com (this is our test site). I have configured it for facebook login and send invitations. In facebook I have configured SiteURL as 'http://login.qa.carryon.com/gs/'. 'login.qa.carryon.com' is our CNAME and we are using Gigya as social third party.
Login is working fine and when users see the list of facebook friends, user will click on one of them and the facebook send dialog triggers. The link parameter for send dialog is something like this 'http://qa.carryon.com/loyalty/signup?userid=xghdt6ys&username=xyz'.
For this link am i getting the error code 100 link invalid or there is other issue in configuration. I am doing this for first time and i cant understand whats going on. Please help i am stuck with no clue.
I had this issue as well and I was using dynamic querystring parameters on a common URL. It seems you are doing the same.
I fixed the issue by forcing Facebook to scrape the URL before I attempt to send it via the FB UI Send Dialog. Use the FB API to hit graph.facebook.com with the URL posted in the id parameter and a scrape parameter set to true.
Like so:
FB.api('https://graph.facebook.com/', 'post', {
id: '[URL]',
scrape: true
}, function(response) {
FB.ui({
method: 'send',
name: '[name]',
picture: '[Picture URL]',
link: '[URL]',
description: '[description]'
});
});
Also answered here.
Does that help?

Facebook Send dialog with API Error code: 100 ('link' is invalid)

I want to provide users with the ability to send money to their Facebook friends through our app (Exvo) by the means of sending an URL to the invitation page via Facebook.
I'm using the 'Send' Facebook dialog (with a redirect to the Facebook webiste). The exact url I'm redirecting the user to is (to field has been redacted):
https://www.facebook.com/dialog/send?app_id=637466739616439&description=You+can+create+an+Exvo+Account+to+accept+this+money+transfer.&display=page&link=https%3A%2F%2Fwww.exvo.com%2Finvitations%2F9fb77bda665f0ae8f58843daec80a29b&name=Pawe%C5%82+Go%C5%9Bcicki+would+like+to+send+you+0.01+EUR&picture=https%3A%2F%2Fthemes.exvo.com%2Fstylesheets%2Fimages%2Fcustom_images%2Flogo.png&redirect_uri=https%3A%2F%2Fwww.exvo.com&to=username
This present me with a Facebook 'Send' dialog. When I type a custom message and press 'Send', I'm presented with this error:
API Error Code: 100
API Error Description: Invalid parameter
Error Message: 'link' is invalid.
The link param (extracted from the above URL and decoded) is this:
https://www.exvo.com/invitations/9fb77bda665f0ae8f58843daec80a29b
which is a valid URL, returning a proper 200 response. Using the Facebook debugger I can see that the provided URL does not generate any errors:
https://developers.facebook.com/tools/debug/og/object?q=https%3A%2F%2Fwww.exvo.com%2Finvitations%2F9fb77bda665f0ae8f58843daec80a29b
Only warnings about inferred properties (I have added those at one point as well, but it did not help).
Also note, that once in a while (like 1 in 10), when I click 'Send', the message gets through and I don't see any errors, which makes it even weirder.
Why is this error happening? What am I doing wrong?
This might not have been the problem in your case, but just for discoverability: make sure that the URL you are sharing is publicly available on the internet (i.e. not within your firewall or on a local computer). FB needs to visit your URL to verify its authenticity.
Like mpcabd has pointed out above, make sure to remove anything with fb, fbdev, facebook in the url because when I did, it solved the issue for me. It is probably a bug or a security measure by Facebook. You are always required to pass a redirect_uri with the link and try mentioning a title as well.
Also your link and redirect_uri must be within your domain that you have provided for the app. Ex: if your app domain in app settings is http://stackexchange.com, you cannot share a link like say https://stackoverflow.com/apps/php/fbsdk/etc/login.php, instead you have to share the link https://stackexchange.com/apps/php/etc/login.php which has worked for me
echo "<a href='https://www.facebook.com/dialog/send?app_id=YOUR_APP_ID&name=Thanks&link=".$linkToShare."&redirect_uri=".$linkToRedirectTo."'/>Send</a>";
You can also assign $title to something.
I figured out something weird, the same thing happened today on the site I manage, the problem seemed to be that the link contains the word facebook in it, so try to remove [facebook, fb, or f if it was a whole word] from your url, it should work, I had a url like open/ID/facebook/ and the only way it worked when I changed it to fopen/ID/ which looks stupid!
So may be in your case this is the problem:
https://www.exvo.com/invitations/9fb77bda665f0ae8f58843daec80a29b
Try to change your url to something without fb or facebook or anything similar.
I had this issue using the send dialog only. I was using dynamic querystring parameters on a common URL. The common URL has been scraped by Facebook but each iteration of the common URL and the querystring parameters would result in this error if Facebook had not scraped that exact URL previously.
I fixed the issue by forcing Facebook to scrape the URL before I attempt to send it via the FB UI Send Dialog. Use the FB API to hit graph.facebook.com with the URL posted in the id parameter and a scrape parameter set to true.
Like so:
FB.api('https://graph.facebook.com/', 'post', {
id: '[URL]',
scrape: true
}, function(response) {
FB.ui({
method: 'send',
name: '[name]',
picture: '[Picture URL]',
link: '[URL]',
description: '[description]'
});
});
I also answered with this solution to the same problem here.
Doing the following fixed it for me:
shorter token (this string in the link param: 9fb77bda665f0ae8f58843daec80a29b, which was 32 characters long, now is at 16) as advised by gkimsal
accepting October 2013 breaking changes, which required me to introduce OpenGraph tags to the page and drop name, description and picture_uri params that I was including when constructing the Send dialog redirect uri
Now Facebook, before displaying the Send dialog to the user, must fetch my page beforehand to retrieve the data (from OG: title, description and image) required to display a proper dialog to the user. I think this is what helped the most in my case.

facebook send API Error Code: 100 API Error Description: Invalid parameter Error Message: 'link' is invalid

I am using facebook post GRAPH UI for posting private message with link to my application in facebook.
Earlier it was working fine but from last two days the dialog started throwing error as :
An error occurred. Please try again later.
API Error Code: 100
API Error Description: Invalid parameter
Error Message: 'link' is invalid.
for sending message I am using code :
function sendMessage(id) {
FB.ui({
method : 'send',
name : 'My APP',
link : 'https://apps.facebook.com/MY_APP/',
to : id,
show_error : 'true',
description : 'my description'
});
}
I have Googled about this and only relevant information I get is that facebook is blocking the link to its own domain as to avoid spam.
as I change the link to other live site its working.
I need to send link to my application as I have to provide such functionality.
I've had similar issues, and figured I'd share the results of my investigation here.
The only information in the Facebook documentation describing the link parameter is not terribly helpful:
link -The URL that is being sent in the message.
There are a couple other StackOverflow questions similar / related to this one:
Facebook API Error 100 - invalid link
this problem ended up being a malformed picture parameter
Facebook FB.ui send dialog intermittently returns invalid link error -
"The issue revolved around our url being dynamic and needing force caching each time. I now make an ajax call to "https://developers.facebook.com/tools/debug/og/object" to refresh it and then launch the send dialog."
I still don't know precisely what constitutes a valid link parameter, but...
Making some inferences from the above questions & responses, as well as some testing on my part, valid link parameters:
Must be "fully qualified". I.E. containing http:// or https://
Must not be facebook.com links
Might not like redirects (or you have to be sneaky with them)
Do support URLs not in the "App Domains" list
Do support Query Strings
May be finicky regarding dynamically generated pages (as in this question)
Apparently Facebook has some sort of link crawling mechanism that performs some unknown tests on a link parameter to determine its validity. I only wish they would choose to document it for us.
Found a solution:
Facebook Send Dialog Error Code: 100 API Error Description: Invalid parameter Error Message: ‘link’ is invalid.
Problem Cause:
Facebook is not allowing to use its own link as to stop spamming.
Problem Solution:
There is as such no solution as its bared by Facebook API.
Other workout:
Shorten URL, but its didn’t works as Facebook check the provided URL.
Redirect URL, same as above.
In my case I have deployed an additional HTML page just use to redirect to the Facebook App link.
Just remember that you should have a timer for few seconds as Facebook scans the provided URL, so it wont be able to detect that the page is redirecting to same Application Link.
I have used the following code for my HTML file:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>My Application</title>
</head>
<body>
<p id="demo"></p>
</body>
<script type="text/javascript">
var url = "https://apps.facebook.com/MY_APPLICATION_ID";
var myVar = setInterval(function() {
myTimer()
}, 1000);
var counter = 3;
function myTimer() {
if (counter == 0) {
window.location.replace(url);
window.clearInterval(myVar);
}
document.getElementById("demo").innerHTML = "you will be redirected in "
+ counter + " seconds...";
counter = counter - 1;
}
</script>
</html>
I had the exact same problem except that my link was pointing to my website.
In case someone is in a similar scenario please check at this solution. Hope that will help some people.
If bad parameter occurs and and message reads "API Error Code: 100" - Make sure the box beside "Share with playlist starting from" is unchecked in youtube and that error won't show.