Page 1 of 2

[beta]SDK v1.3

Posted: 18 Jan 2012, 16:40
by farfa
Hi everyone,
I have published a beta package of the Maniaplanet Web Services SDK. this new version add a new feature for you. Thanks to it, you will be able to create transaction with various cost, or with a dynamic recipient (like on ManiaLoto).
To do it, it's pretty simple if you respect the following documentation.

First step
Creating the transaction.

First you have to create a transaction.

Code: Select all

$t = new \Maniaplanet\WebServices\Transaction();
$t->creatorLogin = 'YourLogin';
$t->creatorPassword = 'YourAccountPassword';
$t->creatorSecurityKey = 'YourValidationKey';
$t->fromLogin = 'thePlayerWhoWillPay';
$t->toLogin = 'thePlayerWhoWillBePaid';
$t->cost = xxx; //The amount the current player have to pay.
$t->message = 'SomethingToIdentifytheTransaction';

$p = new \Maniaplanet\WebServices\Payments('APIUsername','APIPassword');
$idTransaction = $p->create($t);
Second step
Pay the transaction.

To be paid, you just have to redirect the player on a short url with the id of transaction as GET parameter.
e.g: Here is a sample of url to be paied

Code: Select all

manialoto?transaction=idTransaction
Once on this page, the user will see a modal dialog window, which will ask him to pay to access the page.
dialog.jpg
Last step
Check the payment

Once the player has choose to pay or not to access to your page, you have to test, if the payment have been made.
To check the payment you have to call the second method of the payment class, here is an example:

Code: Select all

$idTransaction = $_GET['transaction'];
$p = new \Maniaplanet\WebServices\Paiements('APIUsername','APIPassword');
if($p->isPaid($idTransaction))
{
     //Do Some stuff if it's paid
}
else
{
     //Do Some stuff if it's not paid
}
You can download the beta package here: http://code.google.com/p/maniaplanet-ws ... 3-beta.zip
We will release a new package very soon.

Re: [beta]SDK v1.3

Posted: 18 Jan 2012, 17:58
by m4rcel
Very nice feature :thumbsup:

Without having looked into the code, I have some questions of understanding:
  • Is this payment process manipulatable in any way, our can I be sure that the Planets really have been paid?
  • Is there a maximum amount of Planets which can be paid in a single transaction?
  • In the second step, does this popup appear as soon as there is a "transaction" parameter in the URL? And does this only work with a registered code, or with a "real" URL, too?
Anyway: Good job so far ;)

Re: [beta]SDK v1.3

Posted: 18 Jan 2012, 20:34
by The_Big_Boo
m4rcel wrote:Is this payment process manipulatable in any way, our can I be sure that the Planets really have been paid?
The isPaid() method is as safe as the master server is ;)
m4rcel wrote:Is there a maximum amount of Planets which can be paid in a single transaction?
No (or I don't know it)
m4rcel wrote:In the second step, does this popup appear as soon as there is a "transaction" parameter in the URL?
Yes
m4rcel wrote:And does this only work with a registered code, or with a "real" URL, too?
It works only with registered codes.

Re: [beta]SDK v1.3

Posted: 18 Jan 2012, 21:39
by m4rcel
The_Big_Boo wrote:The isPaid() method is as safe as the master server is ;)
This is safe enough, I think :D


Thanks for answering my questions :)


Another thing I noticed: You called the class "Paiement"... Can you please rename it to the correct English word "Payment"? ^^

Re: [beta]SDK v1.3

Posted: 18 Jan 2012, 22:13
by htbplayer
Really nice Feature. But one question is left opened for me, is it possible to make an automaticaly payout when a user wins a game versus for example a Tic Tac Toe bot or beats the First Highscore in Tetris, Snake or some other minigames?

If its possible i would good to know if we when could choose to either popup a notice or send a ingame private message.

Re: [beta]SDK v1.3

Posted: 18 Jan 2012, 23:15
by konte
Yay, finally! :D
Not that I ever asked for it, but that's just great :) I had a lot of ideas in the past to use this, and I think, this feature will be really useful.

@htbplayer: At the moment it doesn't look like it will work the way you want, but you could do the following: create a button (in the adminpanel or so) where you have to pay the planets for the first winner, and then the page redirects to exactly the same page, so that you pay the next winner and so on, until everything is paid out. This isn't automatical, but you only have to click several times "Yes" instead of needing to send a pm to everyone ;)

Re: [beta]SDK v1.3

Posted: 19 Jan 2012, 11:40
by gouxim
htbplayer wrote:If its possible i would good to know if we when could choose to either popup a notice or send a ingame private message.
Not for now, because the popup is actually for paying the transaction with the authorization of the player.

What you're asking is paying a transaction on behalf of the player. This feature may come in the future with some limitations (eg. something like you can only pay with your own account).

But for now we want to make sure the basics work flawlessly in order to have a very robust transaction system.

Re: [beta]SDK v1.3

Posted: 19 Jan 2012, 11:53
by gouxim
m4rcel wrote:Another thing I noticed: You called the class "Paiement"... Can you please rename it to the correct English word "Payment"? ^^
Thanks. Fixed in the trunk, will be included in the final 1.3 release.

Re: [beta]SDK v1.3

Posted: 27 Jan 2012, 16:27
by Bueddl
Hi,

how to add more than one receipient to the transaction?

Cheers,
Bueddl

Re: [beta]SDK v1.3

Posted: 27 Jan 2012, 17:27
by m4rcel
I guess you gave to create multiple transactions, one for each recipient ;)