I
I
IronVolk2017-06-25 17:42:24
JavaScript
IronVolk, 2017-06-25 17:42:24

Why does FAPI.UI.showPayment() show an error page?

I'm trying to make a payment. 43754c60672b4d8ba25f050303c0f8a2.png
I call:
/*
* Example of showPayment() call.
* Attention! The server must confirm the payment, otherwise the user's funds will not be debited!
* An example of confirmation from the server can be found in the payment.php file.
*/
function showPayment(
type,
count,
cost,
identificator
){
var name = "???";
var description = "???";
var countValue = parseInt(count);
var costValue = parseInt(cost);
if (type == "item") {
description = "Allows you to buy any item in the game. Can be exchanged for Silver Acorns.";
if (countValue == 1) {
name = 'Golden Acorn';
} else if (
(countValue > 1 && countValue < 5) ||
(countValue > 20 && countValue < 25) ||
(countValue > 30 && countValue < 35) ||
(countValue > 40 && countValue < 45) ||
(countValue > 50 && countValue < 55) ||
(countValue > 50 &&
(countValue > 60 && countValue < 65) ||
(countValue > 70 && countValue < 75) ||
(countValue > 80 && countValue < 85) ||
(countValue > 90 && countValue < 95)
) {
name = 'Golden Acorn';
} else {
name = 'Golden Acorns';
}
}
FAPI.UI.showPayment(
name,
description,
identificator,
costValue,
null,
"ok",
"true"
);
}
But a window with an error is shown on the screen.
Judging by the docks ( https://apiok.ru/dev/sdk/js/ui.showPayment) , a preliminary payment confirmation window should appear.
If the user selects yes, then payment.php is called, if he refuses, he returns to the application.
Tell me, please, what's wrong?
Maybe I misunderstood something?
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
IronVolk, 2017-06-29
@IronVolk

Good time of the day!
I apologize for the misunderstanding!
There was my mistake - I passed the wrong string to count - most likely it was perceived as null.
Now everything is fine - when showPayment is called, the window opens as it should.
THE QUESTION IS CLOSED!
Sincerely,
IronVolk

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question