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 API key | |
| Stripe.api_key = "YOUR-API-KEY" | |
| # The ID of the connected account | |
| account = "acct_YourConnectedAccountID" | |
| # Retrieve the last 10 transfers on the connected account | |
| transfers = Stripe::Transfer.list({limit:10},{stripe_account: 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
| require 'stripe' | |
| # Your platform's secret key | |
| Stripe.api_key = "YOUR-API-KEY" | |
| # List `transfer.created` events on the connected account | |
| events = Stripe::Event.list({type: "transfer.created", limit: 100},{stripe_account: "acct_YourConnectedAccountID"}) | |
| # Iterate through each event | |
| events.each do | event | |
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" | |
| account = "acct_YourConnectedAccountID" | |
| # Retrieve available balance for the connected account | |
| balance = Stripe::Balance.retrieve(stripe_account: account) | |
| puts "Available balance: #{balance.available[0].amount}" | |
| puts "Pending balance: #{balance.pending[0].amount}" |
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" | |
| # Authenticate as the connected account and retrieve the first 100 transactions | |
| transactions = Stripe::BalanceTransaction.list({limit: 100},{stripe_account: "acct_YourConnectedAcctID"}) | |
| total_volume = 0 | |
| net_volume = 0 | |
| # Iterate through transactions using auto-pagination |
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" | |
| # Authenticate as the connected account and retrieve the first 100 charges | |
| charges = Stripe::Charge.all({limit: 100},{stripe_account: "acct_YourConnectedAccountID"}) | |
| # Iterate through charges using auto-pagination | |
| charges.auto_paging_each do |charge| | |
| # Output the charge ID, amount, currency, refund, and dispute status |
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 | |
| // Check for a POSTed stripeToken | |
| if (isset($_POST['stripeToken'])){ | |
| // Retrieve the customer id from your database/app, e.g. | |
| // $customer_id = $user->customer_id; | |
| try { | |
| $customer = \Stripe\Customer::retrieve($customer_id); | |
| $customer->source = $_POST['stripeToken']; // The token submitted from Stripe.js | |
| $customer->save(); | |
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 | |
| // Not using composer | |
| require_once('stripe-php/init.php'); | |
| \Stripe\Stripe::setApiKey("sk_test_BQokikJOvBiI2HlWgH4olfQ2"); | |
| try { | |
| $account = \Stripe\Account::create(array( | |
| "managed" => true, | |
| "country" => "US", | |
| "email" => "[email protected]", |
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 | |
| // Require the Stripe library and set your API key | |
| // Newer versions can use https://stripe.com/docs/api/php#cancel_subscription | |
| try { | |
| $token = \Stripe\Token::create(array( | |
| "card" => array( | |
| "number" => "4242424242424242", | |
| "exp_month" => "12", | |
| "exp_year" => "2020" |
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
| var stripe = require('stripe')('YOUR_TEST_KEY'); | |
| stripe.charges.list( | |
| { limit: 100, include: ["total_count"] }, | |
| function(err, charges) { | |
| for (i = 0; i < charges.data.length; i++){ | |
| console.log(charges.data[i].id); | |
| } | |
| if (charges.has_more) { | |
| paginate(charges["data"][charges["data"].length - 1].id); |
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 'sinatra' | |
| require 'stripe' | |
| require 'mailgun' | |
| set :secret_key, ENV['STRIPE_KEY'] | |
| Stripe.api_key = settings.secret_key | |
| set :mailgun_key, ENV['MAILGUN_KEY'] | |
| mg_client = Mailgun::Client.new settings.mailgun_key |