Customer1 is paying to Customer2 after the deduction of (platform fees + stripe Fees). To run such scenario. I did the following steps in Stripe-Connect
:
I can see the created account in Connected account
section.
Verified the account after entering test Legal entity
from the browser itself.
Creating a Charge
object (Customer1 is paying) which also has an application_fee
. The destination account mentioned in the request is newly generated Customer2
account.
I am using the Java
API and it throwing me an error:
Can only apply an application_fee when the request is made on behalf of another account (using an OAuth key, the Stripe-Account header, or the destination parameter).
I tried to follow up here on StackOverflow
and it seems like I need to create a platform account
to initiate such charges. If so, How can I create a Platform account
?
How will it help me to charge the Customer1
and transfer the money to Customer2
connect
account after the deduction of application_fee
?
It sounds a bit confusing to me. Any help or hint would be appreciable.
You already have a platform account here. This is simply the word used to describe the main account (yours) that has connected accounts.
The issue here seems to be with the way you create the Charge. You can only take an application fee if you explicitly make that request on behalf of a connected account. There are currently 2 ways to do this:
Since you are using Custom accounts where you create and own the accounts for your sellers you should use the first approach. In that case, you don't even have to take an application fee. Instead, you simply decide how much to send to the connected account when you create the charge. The idea is that you charge $100 and you only send $90 to the connected account so that you keep $10 for yourself (minus Stripe's fees).
The code would look like this:
// Create the list of parameters for the charge
Map<String, Object> params = new HashMap<String, Object>();
params.put("amount", 10000); // amount to charge in cents
params.put("currency", "usd");
params.put("source", "tok_visa");
// Decide how what to send to the connected account
Map<String, Object> destinationParams = new HashMap<String, Object>();
destinationParams.put("account", "acct_XXXXX"); // connected account id
destinationParams.put("amount", 9000); // amount to send to the connected account
params.put("destination", destinationParams);
Charge charge = Charge.create(params);