domingo, 25 de setembro de 2011

How to create a buy/donate button with dynamic values

This guide will show you how you can request money with amounts defined on the fly by you.
Our API is much more powerful, this guide only shows one of its features.


You can do it using GET or POST.


In GET method, you only need to create an URL:


Example (dummy data)



hash=0996B9142EB307BC5C87ABCC7F5E903FA90591F8
&mtid=456
&notifyUrl=http://www.yoursite.com/notify.php
&errorUrl=http://www.yoursite.com/error.html 
&returnUrl=http://www.yoursite.com/thankyou.html
&desc=donation
&amount=30.00
&cid=1ea0ba02- b3e3- b1e6- 4385-559v7fe04286

How to create this url?

creating the hash:
You just need to concatenate the following variables:
amount + "EUR" + mtid + privateKey + "REQUEST"

amount - must have the format XXXX.XX (always with a dot and 2 decimal values).
mtid - can be any value you like, it is allows you to trace the payment.
privateKey - You can get your private key going to your profile. 
cid / Client ID - You can get your client id going to your profile.

Using POST

<form action="http://yourpaysafe.com/auto/default.aspx" method="post">
<input type="hidden" name="hash" value="0996B9142EB307BC5C87ABCC7F5E903FA90591F8" />
<input type="hidden" name="mtid" value="456" />
<input type="hidden" name="notifyUrl" value="http://www.yoursite.com/notify.php" />
<input type="hidden" name="errorUrl" value="http://www.yoursite.com/error.html" />
<input type="hidden" name="returnUrl" value="http://www.yoursite.com/thankyou.html" />
<input type="hidden" name="desc" value="1000 game credits" />
<input type="hidden" name="amount" value="2.99" />
<input type="hidden" name="cid" value="1ea0ba02- b3e3- b1e6- 4385-559v7fe04286" />
<input type="image" name="submit" src="http://yourpaysafe/img/buttons/default/1.png" alt="Pay with Yourpaysafe" border="0"
/>
</form>


******** This is a draft, will be updated soon!  ******** 
 If you have any question/problem, feel free to ask in comments

Sem comentários:

Enviar um comentário