I am trying to setup the following with Stripe:
- A master account
- Multiple sub-accounts (i.e. connected to the Master account via Stripe Connect app)
- Enable payments to be made to a sub-account, with a percentage fee taken by the Master account per transaction.
I have created a Master account, and a sub account. I have connected the sub account to the Master account via Stripe Connect. I received and stored an access_token and a refresh_token at the end of the Stripe Connect process.
When payments are made, one payment can cover multiple items. I have the following code (PHP) to process the payment:
Stripe_Charge::create(array(
"amount" => $amt,
"currency" => "EUR",
"source" => $stripeCardToken,
"description" => $description),
"application_fee_percent" => 0.5
),
$stripeAccessToken
);
This is placed in a loop, for every item being paid for. It is also in a try / catch block with multiple Stripe exception catches. However, this method fails without any error being thrown.
Is this the correct class method to use?
Is the 'source' field for the credit card token?
Is there a way of tracking amounts paid against multiple items without using a loop?
Is the $stripeAccessToken
the sub-account's access_token returned from the Connect process, or the refresh_token? Or is it the Master Account Publishable / Secret key? Or something else?
Can I use this format for the $stripeAccessToken, or do I have to instead use Stripe::setApiKey($stripeAccessToken)
before the loop?
Both Master and sub-account are currently using the Test environment and a fake card, but I would like to test live transactions also.