[beta]SDK v1.3

Maniaplanet public API, ManiaConnect system and the open source PHP SDK.

Moderator: NADEO

User avatar
farfa
Nadeo
Nadeo
Posts: 601
Joined: 14 Jun 2010, 16:15
Location: In front of your hood with one lap late

[beta]SDK v1.3

Post by farfa » 18 Jan 2012, 16:40

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.
You do not have the required permissions to view the files attached to this post.
Also known as: satanasdiabolo

User avatar
m4rcel
Posts: 653
Joined: 15 Jun 2010, 11:12
Contact:

Re: [beta]SDK v1.3

Post by m4rcel » 18 Jan 2012, 17:58

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 ;)
ImageImage
Image

The_Big_Boo
Posts: 1041
Joined: 15 Jun 2010, 15:46

Re: [beta]SDK v1.3

Post by The_Big_Boo » 18 Jan 2012, 20:34

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.
OS: Win 7 Pro x64
RAM: 2x4GB Corsair @ 1600MHz
CPU: Intel i5 760 @ 3.6GHz
Mobo: Asus P7P55D-E
GPU: NVidia GTX 760 2GB
HDD: WD Black 1TB
Sound: VIA VT1828S (onboard)
Peripherals: Razer DeathAdder - Razer DeathStalker - Logitech F310

User avatar
m4rcel
Posts: 653
Joined: 15 Jun 2010, 11:12
Contact:

Re: [beta]SDK v1.3

Post by m4rcel » 18 Jan 2012, 21:39

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"? ^^
ImageImage
Image

htbplayer
Posts: 31
Joined: 14 Jun 2011, 15:05

Re: [beta]SDK v1.3

Post by htbplayer » 18 Jan 2012, 22:13

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.

konte
Posts: 236
Joined: 15 Jun 2010, 12:36
Location: Germany

Re: [beta]SDK v1.3

Post by konte » 18 Jan 2012, 23:15

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 ;)

User avatar
gouxim
Nadeo
Nadeo
Posts: 1188
Joined: 14 Jun 2010, 17:20

Re: [beta]SDK v1.3

Post by gouxim » 19 Jan 2012, 11:40

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.
Please do not PM for support. Instead, create a thread so that everyone can contribute or benefit from the answer! 8-)

User avatar
gouxim
Nadeo
Nadeo
Posts: 1188
Joined: 14 Jun 2010, 17:20

Re: [beta]SDK v1.3

Post by gouxim » 19 Jan 2012, 11:53

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.
Please do not PM for support. Instead, create a thread so that everyone can contribute or benefit from the answer! 8-)

Bueddl
Posts: 165
Joined: 27 Jun 2010, 11:39

Re: [beta]SDK v1.3

Post by Bueddl » 27 Jan 2012, 16:27

Hi,

how to add more than one receipient to the transaction?

Cheers,
Bueddl
http://www.tmserver.org | Mania Exchange
═╦═╔╦╗² | MP4 Beta

User avatar
m4rcel
Posts: 653
Joined: 15 Jun 2010, 11:12
Contact:

Re: [beta]SDK v1.3

Post by m4rcel » 27 Jan 2012, 17:27

I guess you gave to create multiple transactions, one for each recipient ;)
ImageImage
Image

Post Reply

Return to “Maniaplanet Web Services”

Who is online

Users browsing this forum: No registered users and 2 guests