<?php
require_once 'allopass-apikit-php5/api/AllopassAPI.php';
$api = new AllopassAPI();

$response = $api->createDiscreteButton(array(
 'site_id' => 283167, 
 'product_name' => 'test product', 
 'forward_url'=> 'http://rift.trionworlds.com/success', 
 'amount' => '20.99', 
 'reference_currency' => 'EUR', 
 'price_mode' => 'price', 
 'price_policy' => 'high-preferred',
 'category' => array('direct-debit'),
 //'country' => array('UK'),
 'currency' => 'EUR'
));
 
 echo $response->getBuyUrl(), "\n-----\n" . '<br/>';
 echo $response->getCheckoutButton();
 
 /*
 amount=107.88
 &api_hash=sha1
 &api_key=5adc02e2dc22606d47e921c8223529a8
 &api_sig=7c0ba4979ebcc2bad3fd0266f906e48a710d8c47
 &api_ts=1345222155646
 &category[direct-debit]=direct-debit
 &country[DE]=DE
 &currency=EUR
 &data=AccountId%3A213440%3BProduct%3ARIFT_PROMO_SLANNUAL
 &error_url=http%3A%2F%2Frift.trionworlds.com%2Fcommerce%2Fpurchase%2Fproducts%2Fpurchase-product-flow.action%3Fexecution%3De2s4%26_eventId%3DallopassError
 &format=xml
 &forward_url=http%3A%2F%2Frift.trionworlds.com%2Fcommerce%2Fpurchase%2Fproducts%2Fpurchase-product-flow.action%3Fexecution%3De2s4%26_eventId%3DallopassSuccess
 &merchant_transaction_id=23675281
 &notification_url=https%3A%2F%2Fcallback-prod.trionworlds.com%2Fcamel%2Fallopass
 &price_mode=price
 &price_policy=nearest
 &product_name=Storm+Chaser+Edition
 &reference_currency=USD
 &site_id=286385
 
 
 */
$response = $api->prepareTransaction(array(
 'site_id' => 286385, 
 'pricepoint_id' => 1034, 
 'product_name' => 'Storm Chaser Edition', 
 'forward_url'=> 'http://rift.trionworlds.com/success', 
 'amount' => '10', 
 'reference_currency' => 'EUR', 
 //'data' => 'bla blab bla',
 //'merchant_transaction_id' => 'TRANS765',
 //'country' => 'US'
 //'type' => array('premium-calling')
));
//echo $response; 
$url = $response->getBuyUrl();

//echo $url;
echo '<br><a href="'.$url . '" >10 GBP</a>';

$response2 = $api->prepareTransaction(array(
 'site_id' => 286385, 
 'pricepoint_id' => 629, 
 'product_name' => 'test GBP product', 
 'forward_url'=> 'http://rift.trionworlds.com/success', 
 'amount' => '5', 
 'reference_currency' => 'USD', 
 //'data' => 'bla blab bla',
 //'merchant_transaction_id' => 'TRANS765',
 //'country' => 'US'
 //'type' => array('premium-calling')
));
//echo $response; 
$url2 = $response2->getBuyUrl();

//echo $url;
echo '<br><a href="'.$url2 . '" >5 GBP</a>';

$response3 = $api->prepareTransaction(array(
 'site_id' => 286385, 
 'pricepoint_id' => 1034, 
 'product_name' => 'test GBP product', 
 'forward_url'=> 'http://rift.trionworlds.com/success', 
 'amount' => '3', 
 'reference_currency' => 'EUR', 
 //'data' => 'bla blab bla',
 //'merchant_transaction_id' => 'TRANS765',
 //'country' => 'US'
 //'type' => array('premium-calling')
));
//echo $response; 
$url3 = $response3->getBuyUrl();

//echo $url;
echo '<br><a href="'.$url3 . '" >3 GBP</a>';

$response4 = $api->createDiscreteButton(array(
'site_id' => 286385, 
 'product_name' => 'test product', 
 'forward_url'=> 'http://rift.trionworlds.com/success', 
 'amount' => '107.88', 
 'currency' => 'EUR',
 'reference_currency' => 'USD', 
 'price_mode' => 'price', 
 'price_policy' => 'nearest',
'category' => array('direct-debit'),
'country' => array('DE')
));

$url4 = $response4->getBuyUrl();

//echo $url;
echo '<br><a href="'.$url4 . '" >DIRECT DEBIT</a>';

$response5 = $api->createDiscreteButton(array(
'site_id' => 286385, 
 'product_name' => 'test product', 
 'forward_url'=> 'http://rift.trionworlds.com/success', 
 'amount' => '107.88', 
 'currency' => 'EUR',
 'reference_currency' => 'USD', 
 'price_mode' => 'price', 
 'price_policy' => 'nearest',
'type' => array('paysafecard')
));

$url5 = $response5->getBuyUrl();

//echo $url;
echo '<br><a href="'.$url5 . '" >Paysafe</a>';
