I've been attempting to implement the new facebook payment flow for local currency as per their documentation (https://developers.facebook.com/docs/howtos/payments/)
Have the company set up, have the product set up, have the payment FB.ui call set up, have the payments callback set up as required for it.
The issue I have is as soon as I call the FB.ui method to invoke a pay dialogue I get the error "Your Action Could Not Be Processed" on screen. Then once I hit ok my javascript callback gets the error message "App not allowed to use new flow." error code "1383005". I can't seem to find any help about this error message or error code (the error code is listed as "PermissionDenied - Facebook system issue" in the Error codes section). My question is am I missing something? There is nothing I can see in the docs that tells me how to allow my app to use the new flow or even telling me that I have to.
My payment dialogue code just in case:
var purchaseProduct = function (productUrl, callback) {
var obj = {
method: 'pay',
action: 'purchaseitem',
product: productUrl
};
FB.ui(obj, function(response) {
callback(response);
});
};
(The quantity and request_id parameters are optional)
Thanks
Related
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.
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
I'm trying to integrate Payer Promotions for our facebook game. I put a link to initiate payer promotion with js-sdk and created a callback function. using this sample:
<!-- Simple unit for Payer Promotion (payer_promotion)
Determine visibility of the unit from the above eligibility API -->
<button onclick="payer_promotion();">Payer Promotion</button>
<script>
// On load, the user hasn't clicked on the payer_promotion unit
var has_clicked = false;
var dialog_window;
function payer_promotion() {
if (!has_clicked) {
// If first click, open payer_promotion dialog
var obj = {
method: 'fbpromotion',
display: 'popup',
quantity: 10,
product: 'http://currency.object.url'
};
FB.ui(obj, function(){
// call back to your server to see if user's balance changed
});
// Mark unit as clicked by user
has_clicked = true;
} else {
// For subsequent clicks, alert user
alert("Payer Promotion already clicked!");
}
}
</script>
So everything works expected with my payment tester account and i claimed my free promotion... or so facebook says. once the transactions is completed and user closes the new popup facebook opened, I'm left with just a callback with no arguments and no idea whatever happened between facebook and the user. callback function has "// call back to your server to see if user's balance changed" comment but since facebook changed to local currency I'm doing payment processing locally with order_id (not facebook->my server it used to be). So if I don't get order_id I have no means to figure out if I should process the promotion or not.
The question is, am I missing something? is there a way to figure out if the promotion succeeded or not?
I want to follow up this question. I use FB.ui to send link and got exactly the same error for some users. Is there anyway to check it and decide whether to display the ui to the user ?
API Error Code: 100
API Error Description: Invalid parameter
Error Message: Viewer cannot message specified recipients.
<a href='#' onClick="
FB.ui({
method: 'send',
link: 'http://www.xxxxxxxxxxx.com',
to: ###########,
});
">Send a message</a>
Even when I use the url send method, some user does not work. For example:
Error User : https://www.facebook.com/dialog/send?app_id=123050457758183&name=People%20Argue%20Just%20to%20Win&link=http://www.nytimes.com/2011/06/15/arts/people-argue-just-to-win-scholars-assert.html&redirect_uri=https://www.bancsabadell.com/cs/Satellite/SabAtl/&to=100000104626944
Normal User: https://www.facebook.com/dialog/send?app_id=123050457758183&name=People%20Argue%20Just%20to%20Win&link=http://www.nytimes.com/2011/06/15/arts/people-argue-just-to-win-scholars-assert.html&redirect_uri=https://www.bancsabadell.com/cs/Satellite/SabAtl/&to=1311251197
(this is the share link example taken from https://developers.facebook.com/docs/reference/dialogs/send/)
bug reported to facebook: https://developers.facebook.com/bugs/538638372825668
Edit: in fact, everyone should be reachable through messages now. It's only there are new "filtering preferences". I guess this can_message field is now useless because it should always return true. I think it is going to be deprecated in a while.
In the user FQL table, you have a field that must verify what you need:
can_message (boolean): whether the user can send a message to another user
Source: https://developers.facebook.com/docs/reference/fql/user
select can_message from user where uid=USER_ID
USER_ID being the person that your app user want to send a message to.
You can use the FB api;
I use something like:
FB.api('/me/permissions', function (response)
{
//check contents of response for required permissions here
fb_publish_perm = response.data[0]['publish_stream'] ? response.data[0]['publish_stream'] : false;
if (fb_publish_perm)
{
// it permissions exist
}
else
{
// permissions dont exist launch the ui to request.
}
});
Please treat the above as psedo code, as it came straight off the top of my head!
When I use the Send dialog using the Facebook JS SDK FB.ui call, the callback does not trigger.
FB.ui(
{
method: 'send',
to: ****, // fbId
redirect_uri: *****, // public URL in my app domain
link: ***** // public URL
},
function(response) {
alert('callback was called!');
if (response != null) {
console.log('Request was passed along!');
location.href= ***; // just in case redirect_uri doesn't work
return true;
}
else {
console.log('Not passed along. User clicked cancel');
}
}
);
Expected behavior: The alert should be shown. The console message should be logged. And the user should be sent to the redirect_uri.
Actual Behavior: None of these 3 things happen. The Send dialog opens and the to: field is pre-populated correctly. When I click Send, it is sent correctly. But I need the callback to be triggered and the user needs to be sent to redirect_uri.
Remove the redirect_uri item and the call back will be fired.
I was facing the same issue a few mins back and realized that removing the redirect_uri solved it.
Every FB.UI has a callback function and it applies to Send dialog also.
See this document for general syntax for FB.UI.
But the problem is as other FB.UI methods, SEND method doesn't have a return value.
As per Facebook documentation ,
If sending the message is successful, the user will be redirected to the redirect_uri. Otherwise, an error will be shown. Unlike the Like
Button, there is no return value per se.
So if the message sending is successful and you dont have a redirect_uri then the callback will have nothing as a return value and otherwise sends error when message sending is failed.
To confirm that callback is working use the following code,
FB.ui({
method: 'send',
name: 'People Argue Just to Win',
link: 'http://www.nytimes.com/2011/06/15/arts/people-argue-just-to-win-scholars-assert.html',
},
function(response){
alert(response);
if(response != null){
alert('user clicked send');
}else{
alert('user clicked cancel');
}
});
when you click send and message is sent successfully , it will alert an empty string and when u click cancel it will alert 'null'.
Have you verified on other browsers? Check your browser settings once.
Do you have an extension like "Facebook Disconnect" installed?