<?php require __DIR__ . '/vendor/autoload.php'; Httpful\Bootstrap::init(); RESTful\Bootstrap::init(); Balanced\Bootstrap::init(); Balanced\Settings::$api_key = "ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY"; $debit = Balanced\Debit::get("/debits/WD5EW7vbyXlTsudIGF5AkrEA");
<?php require __DIR__ . '/vendor/autoload.php'; Httpful\Bootstrap::init(); RESTful\Bootstrap::init(); Balanced\Bootstrap::init(); Balanced\Settings::$api_key = "ak-test-22IOkhevjZlmRP2do6CZixkkDshTiOjTV"; $debit = Balanced\Debit::get("/debits/WD4SOTNKiZbBFrmMk6mfszIl"); $debit->refunds->create(array('description' => 'Refund for Order #1111', 'meta' => array("fulfillment.item.condition" => "OK", "merchant.feedback" => "positive", "user.refund_reason" => "not happy with product")));
<?php // $debit_href is the stored href for the Debit // $order_href is the stored href for the Order $debit = Balanced\Debit::get($debit_href); $debit->refunds->create(array('description' => 'Refund for Order #1111', 'meta' => array("fulfillment.item.condition" => "OK", "merchant.feedback" => "positive", "user.refund_reason" => "not happy with product"), 'order' => $order_href));
print "ok, no more holds! let's capture it (for the full amount)\n"; $debit = $the_hold->capture(); print "hmm, ho much money do i have in escrow? it should equal the debit amount\n"; $marketplace = Balanced\Marketplace::mine(); if ($marketplace->in_escrow != 1500) { throw new Exception("1500 is not in escrow! This is wrong"); } print "I have " . $marketplace->in_escrow . " in escrow!\n"; print "Cool. now let me refund the full amount"; $refund = $debit->refund(); print "ok, we have a merchant that's signing up, let's create an account for them first, let's create their bank account\n"; $bank_account = $marketplace->createBankAccount("Jack Q Merchant", "123123123", "123123123"); $identity = array("type" => "person", "name" => "Billy Jones", "street_address" => "801 High St", "postal_code" => "94301", "country" => "USA", "dob" => "1979-02", "phone_number" => "+16505551234"); $merchant = $marketplace->createMerchant('*****@*****.**', $identity, $bank_account->uri); print "our buyer is interested in buying something for \$130\n"; $another_debit = $buyer->debit(13000, "MARKETPLACE.COM"); print "let's credit our merchant \$110\n"; $credit = $merchant->credit(11000, "Buyer purchase something on Marketplace.com"); print "let's assume the marketplace charges 15%, so it earned \$20\n"; $mp_credit = $marketplace->owner_account->credit(2000, "Commission from MARKETPLACE.COM"); print "ok, let's invalidate the card used so it cannot be used again\n"; $card->is_valid = false; $card->save(); print "how do we look up an existing object from the URI?\n"; $the_buyer = Balanced\Account::get($buyer->uri); print "we got the buyer " . $the_buyer->email_address . "\n"; $the_debit = Balanced\Debit::get($debit->uri); print "we got the debit: " . $the_debit->uri . "\n"; $the_credit = Balanced\Credit::get($credit->uri); print "we got the credit: " . $the_credit->uri . "\n"; print "and there you have it :)\n";
<?php require __DIR__ . '/vendor/autoload.php'; Httpful\Bootstrap::init(); RESTful\Bootstrap::init(); Balanced\Bootstrap::init(); Balanced\Settings::$api_key = "ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY"; $debit = Balanced\Debit::get("/debits/WD5SwXr9jcCfCmmjTH5MCMFD"); $dispute = $debit->dispute;
<?php require __DIR__ . '/vendor/autoload.php'; Httpful\Bootstrap::init(); RESTful\Bootstrap::init(); Balanced\Bootstrap::init(); Balanced\Settings::$api_key = "ak-test-22IOkhevjZlmRP2do6CZixkkDshTiOjTV"; $debit = Balanced\Debit::get("/debits/WD4vEUJj36IpPHTnLKMYzHgh");
<?php require __DIR__ . '/vendor/autoload.php'; Httpful\Bootstrap::init(); RESTful\Bootstrap::init(); Balanced\Bootstrap::init(); Balanced\Settings::$api_key = "ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY"; $debit = Balanced\Debit::get("/debits/WD5Nd61WpdlRk6D39YVNFAEo"); $debit->refunds->create(array('description' => 'Refund for Order #1111', 'meta' => array("fulfillment.item.condition" => "OK", "merchant.feedback" => "positive", "user.refund_reason" => "not happy with product")));
<?php require __DIR__ . '/vendor/autoload.php'; Httpful\Bootstrap::init(); RESTful\Bootstrap::init(); Balanced\Bootstrap::init(); Balanced\Settings::$api_key = "ak-test-22IOkhevjZlmRP2do6CZixkkDshTiOjTV"; $debit = Balanced\Debit::get("/debits/WD4YCKAyFrQBFYuFCUCRynOx"); $dispute = $debit->dispute;