Answer the question
In order to leave comments, you need to log in
Where should the API_callback be located?
I work with javascript and FAPI classmates. I call FAPI.init - everything is successful. I call FAPI.UI.showPayment() - a successful purchase occurs. Question: where should the callback from the payment come from? To some function called API_callback? Where should she be? If at the same level as FAPI.init, then it is not called. In the browser console, when making a purchase, it says "Uncaught TypeError: c.__FAPI__CallBack is not a function". I put the function in different places, called it different options. Maybe it needs to be registered somewhere? I think a good hour on this.
Answer the question
In order to leave comments, you need to log in
I did this: I called a js function in the browser from AS3. The function name was chosen ala myAwesomeFunc.
To be honest, I do not quite understand what the problem is. Yes, there should be a callback function in the script code (in the same place as the FAPI initialization function):
/*
* Эта функция вызывается после завершения выполнения следующих методов:
* showPermissions, showInvite, showNotification, showPayment, showConfirmation, setWindowSize
*/
function API_callback(method, result, data) {
console.log("Method " + method + " finished with result " + result + ", " + data);
if (method == "showConfirmation" && result == "ok") {
FAPI.Client.call(feedPostingObject, function(status, data, error) {
console.log("status = " + status + " data = " + data + " error == "
+ (error != null ? error["error_msg"] : "null"));
getFlash().publishCallback({"status":status, "data":data, "error":error});
}, data);
}
//invoke client API callback
getFlash().onApiCallBack({"method":method, "result":result, "data":data});
}
private function onApiCallBack(event: Object): void {
trace("[OKManager] onApiCallBack: method =", event.method,
" result =", event.result, " data =", event.data);
if (event.method == 'showPayment') {
.......
} else if (event.method == "showConfirmation") {
.......
}
.............
}
The issue has already been partially resolved. For me personally, this only works in Mozilla (always) and in Opera (once). Since I myself use Google Chrome, but it doesn’t work in it, that’s why I sounded the alarm. However, I would like it to work in Google.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question