Last active
September 17, 2018 17:37
-
-
Save karlr-stripe/a9447ef36d688afd84a5c1f3f9b294cf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ##### this code will cause any errors to result in Exceptions instead | |
function exception_error_handler($severity, $message, $file, $line) { | |
if (!(error_reporting() & $severity)) { | |
// This error code is not included in error_reporting | |
return; | |
} | |
throw new ErrorException($message, 0, $severity, $file, $line); | |
} | |
set_error_handler("exception_error_handler"); | |
error_reporting(E_ALL); | |
// ##### | |
require_once('stripe-php-6.17.1/init.php'); | |
\Stripe\Stripe::setApiKey("sk_test_xxxxx"); | |
$stripeAccount = \Stripe\Account::create(array( | |
"type" => "custom", | |
"country" => "US", | |
"email" => "[email protected]" | |
)); | |
print "Account created\n"; | |
$stripeAccount->legal_entity->type = "company"; | |
$stripeAccount->legal_entity->additional_owners = array( | |
array( | |
'first_name' => 'Bob', | |
'last_name' => 'Smith' | |
) | |
); | |
$stripeAccount->save(); | |
$stripeAccount = \Stripe\Account::retrieve($stripeAccount->id); | |
print "Initial additional owners added\n"; | |
print "Adding other additional owners...\n"; | |
$count = count($stripeAccount->legal_entity->additional_owners); | |
$newAdditionalOwner = array( | |
array('first_name' => 'Jane', 'last_name' => 'Smith') | |
); | |
$stripeAccount->legal_entity->additional_owners[$count] = $newAdditionalOwner; | |
$stripeAccount = $stripeAccount->save(); | |
print "Other additional owners added\n"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment