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
| require 'stripe' | |
| # Your API key | |
| Stripe.api_key = 'YOUR-API-KEY' | |
| # Retrieve the balance transactions associated with a specific transfer | |
| txns = Stripe::BalanceTransaction.list({ transfer: 'tr_18V4GALrKpFcM2405wrIONb9', limit: 100 }) | |
| # Iterate through and list each balance transaction | |
| txns.auto_paging_each do | txn | | |
| # Don't include the transfer balance transaction |
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
| require 'stripe' | |
| Stripe.api_key = "YOUR-API-KEY" | |
| declines = Stripe::Charge.list(paid: false, limit: 100) | |
| declines.auto_paging_each do |decline| | |
| # Format the timestamp | |
| formatted_date = Time.at(decline.created) | |
| # Output the date, card id, brand, last 4, and decline message |
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
| require 'stripe' | |
| Stripe.api_key = "YOUR-API-KEY" | |
| declines = Stripe::Charge.list(paid: false, limit: 100) | |
| declines.auto_paging_each do |decline| | |
| puts "#{decline.id},#{decline.failure_code},#{decline.failure_message}" | |
| end |
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
| require 'stripe' | |
| # Your platform's secret key | |
| Stripe.api_key = "YOUR-SECRET-KEY" | |
| connected_account = "CONNECTED-ACCOUNT-ID" | |
| now = Time.now.to_i | |
| # List `transfer.created` events on the connected account | |
| events = Stripe::Event.list({type: "transfer.created", limit: 100},{stripe_account: connected_account}) |
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
| <? | |
| \Stripe\Customer::create(array( | |
| "source" => $_POST['stripeToken'], // obtained with Checkout | |
| "description" => "Charge for [email protected]", | |
| "shipping" => array( | |
| "name" => $_POST['stripeShippingName'], | |
| "address" => array( | |
| "line1" => $_POST['stripeShippingAddressLine1'], | |
| "apt" => $_POST['stripeShippingAddressApt'], | |
| "postal_code" => $_POST['stripeShippingAddressZip'], |
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 | |
| // Include Stripe's library and set your API key. | |
| require('./config.php'); | |
| // Retrieve the account ID and amount details from your own database... | |
| // Ex: $db is an object containing the attributes you retrieve from your database. | |
| // Check for a submitted token | |
| if (isset($_POST['stripeToken'])){ |
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, |
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 | |
| // Include Stripe's library and set your API key. | |
| require('./config.php'); | |
| // Retrieve the account ID and application fee tier details from your own database... | |
| // In this example $db is an object containing the attributes you retrieve from your database. | |
| // Calculate the app fee to charge based on the pricing tier | |
| if ($db->pricing_tier == 1){ | |
| // Charge 2.9% + $.30 per charge (passing Stripe's default processing fees) |
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 | |
| // Include Stripe's library and set your API key. | |
| require('./config.php'); | |
| // Retrieve the amount and application fee details from your own database... | |
| // Ex: $db is an object containing the attributes you retrieve from your database. | |
| // Calculate the application fee to charge, in cents | |
| $application_fee = ($db->amount/100 * $db->percent_fee + $db->flat_fee) * 100; |
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 | |
| // Including the library instead of using Composer | |
| // Read more about installing this library here: https://github.com/stripe/stripe-php | |
| require_once('stripe-php/init.php'); | |
| // Replace with your API keys | |
| $stripe = array( | |
| "secret_key" => "YOUR-SECRET-API-KEY", | |
| "publishable_key" => "YOUR-PUBLISHABLE-API-KEY" |