have a website that's using Stripe Connect and Express to act as a platform for sellers
kk
In all of the Stripe documentation that I've seen, the application fee amount is expressed as a whole number.
Indeed. This is because Stripe uses JSON, and JSON does not guarantee that numeric values with decimal (radix) digits are preserved - this is because JSON uses JavaScript/ECMAScript's number
type which is based on IEEE-754 which cannot be used to reliably store non-integer amounts, hence why Stripe uses "integer cents" instead of "floating dollars" to store currency values.
If I didn't want to charge a fixed dollar amount, how can I go about expressing this as a percentage of the sale price?
You can't - and you don't need to.
Stripe's entire business-model is based around having a developer-friendly web-service API (unlike say, PayPal or Authorize.net, which are both actively hostile to developers, for reasons I won't get into, but if anyone from PayPal is listening, please fix your broken non-immutable transaction history feature, that's just being irresponsible!) - ergo the implication is you are a developer who knows how to define a percentage in your own application code:
const AMOUNT = 500;
const PERCENTAGE_WHATEVER = 0.1; // 0.1 == 10%
const myStripeRequestDto = {
application_fee_amount: AMOUNT,
transfer_data: {
destination: Math.floor( AMOUNT * PERCENTAGE_WHATEVER);
}
}
const resp = await sendRequestToStripe( myStripeRequestDto );