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
<? | |
\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
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
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' | |
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' | |
# 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
import stripe | |
stripe.api_key = "YOUR-TEST-KEY" | |
# Retrieve all charges | |
charges = stripe.Charge.all(limit=100) | |
# Use auto-pagination to iterate through them | |
for charge in charges.auto_paging_iter(): | |
# Output charge IDs | |
print(charge.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
files: | |
"/tmp/45_nginx_https_rw.sh": | |
owner: root | |
group: root | |
mode: "000644" | |
content: | | |
#! /bin/bash | |
CONFIGURED=`grep -c "return 301 https" /opt/elasticbeanstalk/support/conf/webapp_healthd.conf` |
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
# Create a charge for $100 and take a $10 commission for the platform | |
charge = Stripe::Charge.create( | |
{ | |
amount: 10000, # Charge amount in cents | |
currency: "usd", # The currency of the charge | |
source: "src_1BF7yx2jy8PDLWD6TFmguGn0", # A source token representing a Visa card | |
application_fee: 1000 # The commission your platform is taking | |
}, | |
{ |
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
# Refund a charge | |
refund = Stripe::Refund.create( | |
{ | |
charge: "ch_1BAkyv2jy8PDLWD6E4t2XxPX", # The ID of the charge to refund | |
refund_application_fee: true # Optionally give your platform commission back to the user | |
}, | |
{ | |
stripe_account: "acct_j1cXUEAksEpalsjc3Xl3" # The ID of the Stripe account connected to your platform | |
} |