Hi guys,
I'm developing a payments solution based on Stripe connected accounts.
I've recently started to make some tests for edge scenarios and I ended up on some unexpected results.
In those tests I create random connected accounts with:
```
$account = \Stripe\Account::create(array(
"managed" => true,
"country" => "US",
"email" => $email
));
```
So transfers schedules are manual on 2 days rolling
I create tokens for simulating credit cards:
```
$token = \Stripe\Token::create(array(
"card" => array(
"number" => "4242424242424242",
"exp_month" => 1,
"exp_year" => date('Y', strtotime('+1 year')),
"cvc" => "000"
)
));
```
And finally all charges use the destination parameter
```
$charge = \Stripe\Charge::create(array(
"amount" => $amount*100,
"currency" => "usd",
"source" => $token->id,
"description" => "Test charge--StripeChargeAccountWithoutPaymentInfo",
"application_fee" => 100,
"capture" => true,
"destination" => $account->id
));
```
* Test scenario 1: Rejected account
In this scenario I wanted to see what happens when I create a charge over a rejected account.
I created the account, the normal way and then I reject the account with:
```
$account->reject([
"reason" => "fraud"
]);
```
Then I wait 60 seconds, giving time for Stripe to update any structure related to this account--this probably wasn't needed, still...
Then I refresh the account object and test for `charges_enabled` and `transfer_enabled`--both are false, as I expected.
Finally I try to charge for the connected account, and the charge is a success--which I did not expect.
After browsing in the dashboard I see I have a charge on the platform account, a transfer for the connected account and a payment on the connected account.
My big questions here are:
- why was this charge allowed?
- what happens to the charge in the long run, I mean will the charge ever be refunded to the client? When does this happen?
- can you guarantee that the connected account payment for this (and other charges) won't ever be transferred?
* Test scenario 2: Not verified account and a lot of charges
In this test I tried to create charges for an account that have accepted TOS and have an external account.
I create several "$token" and "$charge" objects for the "$account". The total amount was $25000
Every charge was a success--expected.
After browsing in the dashboard I see I have all charges on the platform account, all transfers for the connected account and all related payments on connected account--ok expected.
My questions:
- Does any of this amount will ever be transferred to this account external account if there's no action for identifying the account?
- Can you confirm the due_by parameter will be set? When it will be set?
* Test scenario 3: Past due account
In this test I've used an old connected account that have long be due.
I retrieve the account object and test for `charges_enabled` and `transfer_enabled`--both are false, as I expected.
Finally I try to charge for the connected account, and the charge is a success--which I did not expect.
My big questions here are:
- why was this charge allowed?
- what happens to the charge in the long run, I mean will the charge ever be refunded to the client? When does this happen?
- can you guarantee that the connected account payment for this (and other charges) won't ever be transferred?
----
Thank you guys!
José,