[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 require('vendor/autoload.php'); 4 5 Httpful\Bootstrap::init(); 6 RESTful\Bootstrap::init(); 7 Balanced\Bootstrap::init(); 8 9 $API_KEY_SECRET = '5f4db668a5ec11e1b908026ba7e239a9'; 10 Balanced\Settings::$api_key = $API_KEY_SECRET; 11 $marketplace = Balanced\Marketplace::mine(); 12 13 print "create a card\n"; 14 $card = $marketplace->cards->create(array( 15 "card_number" => "5105105105105100", 16 "expiration_month" => "12", 17 "expiration_year" => "2015" 18 )); 19 print "our card: " . $card->uri . "\n"; 20 21 print "create a **buyer** account with that card\n"; 22 $buyer = $marketplace->createBuyer(null, $card->uri); 23 print "our buyer account: " . $buyer->uri . "\n"; 24 25 print "debit our buyer, let's say $15\n"; 26 try { 27 $debit = $buyer->debit(1500); 28 print "our buyer debit: " . $debit->uri . "\n"; 29 } 30 catch (Balanced\Errors\Declined $e) { 31 print "oh no, the processor declined the debit!\n"; 32 } 33 catch (Balanced\Errors\NoFundingSource $e) { 34 print "oh no, the buyer has not active funding sources!\n"; 35 } 36 catch (Balanced\Errors\CannotDebit $e) { 37 print "oh no, the buyer has no debitable funding sources!\n"; 38 } 39 40 print "and there you have it 8)\n"; 41 42 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |