managedAccount === null) { self::authorizeFromEnv(); $account = self::createTestManagedAccount(); $charge = \Stripe\Charge::create(array( 'currency' => 'usd', 'amount' => '10000', 'source' => 'tok_bypassPending', 'destination' => array( 'account' => $account->id ) )); $this->managedAccount = $account; } return $this->managedAccount; } private function createPayoutFromManagedAccount($accountId) { $payout = Payout::create( array( 'amount' => 100, 'currency' => 'usd', ), array( 'stripe_account' => $accountId ) ); return $payout; } public function testCreate() { $account = self::createAccountWithBalance(); $payout = self::createPayoutFromManagedAccount($account->id); $this->assertSame('pending', $payout->status); } public function testRetrieve() { $account = self::createAccountWithBalance(); $payout = self::createPayoutFromManagedAccount($account->id); $reloaded = Payout::retrieve($payout->id, array('stripe_account' => $account->id)); $this->assertSame($reloaded->id, $payout->id); } public function testPayoutUpdateMetadata() { $account = self::createAccountWithBalance(); $payout = self::createPayoutFromManagedAccount($account->id); $payout->metadata['test'] = 'foo bar'; $payout->save(); $updatedPayout = Payout::retrieve($payout->id, array('stripe_account' => $account->id)); $this->assertSame('foo bar', $updatedPayout->metadata['test']); } public function testPayoutUpdateMetadataAll() { $account = self::createAccountWithBalance(); $payout = self::createPayoutFromManagedAccount($account->id); $payout->metadata = array('test' => 'foo bar'); $payout->save(); $updatedPayout = Payout::retrieve($payout->id, array('stripe_account' => $account->id)); $this->assertSame('foo bar', $updatedPayout->metadata['test']); } }