Last active
March 27, 2017 17:26
-
-
Save ehongyu/8f270ece88fffdd99d586e45b2907dee to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
// include stripe PHP lib path here | |
// set up API key | |
\Stripe\Stripe::setApiKey("your API key here"); | |
$managed_account = \Stripe\Account::create([ | |
'managed' => true, | |
'email' => '[email protected]' | |
]); | |
// create a debit card recipient | |
$token = \Stripe\Token::create([ | |
'card' =>[ | |
'name' => 'John Doe', | |
'number' => '4000056655665556', | |
'exp_month' => '01', | |
'exp_year' => '2020', | |
'cvc' => '123', | |
'address_line1' => '1207 2nd St', | |
'address_line2' => '2rd Floor', | |
'address_state' => 'CA', | |
'address_city' => 'Santa Monica', | |
'address_zip' => 90401, | |
// 'currency' => 'usd' | |
] | |
]); | |
$recipient = \Stripe\Recipient::create([ | |
"name" => 'John Doe', | |
"type" => "individual", | |
'card' => $token->id | |
]); | |
// re-tokenize the debit card recipient | |
$token = \Stripe\Token::create( | |
[ | |
'recipient' => $recipient->id, | |
'card' => $recipient->cards->data[0]->id | |
], | |
[ | |
'stripe_account' => $managed_account->id | |
] | |
); | |
// link the debit card to the managed account | |
$managed_account->external_accounts->create([ | |
'external_account' => $token->id | |
]); | |
$managed_account->save(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have tried to assign the currency to the card like this after line 26, but it didn't help: