Last active
September 21, 2016 22:53
-
-
Save adamjstevenson/ca87f7b7cf20e14610c02960d7fb0a6c to your computer and use it in GitHub Desktop.
Add Stripe's processing fee and your platform application fee as metadata
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 | |
$charge = \Stripe\Charge::create(array( | |
"amount" => $db->amount, // The total amount to charge the customer, in cents | |
"currency" => "usd", | |
"source" => $token, // The token submitted from Checkout or Stripe.js | |
"application_fee" => $application_fee, | |
"destination" => $db->connected_account_id, // The account ID, retrieved from your database | |
"metadata" => array( | |
// Calculate Stripe's processing fee based on the total charge amount | |
"stripe fee" => ($db->amount/100 * .029 + .30) * 100, | |
// The remainder of your application fee is the commission for your platform | |
"application fee" => $application_fee - (($db->amount/100 * .029 + .30) * 100) | |
) | |
)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment