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 $10 | |
charge = Stripe::Charge.create({ | |
amount: 1000, | |
currency: "usd", | |
source: "src_1BF7yx2jy8PDLWD6TFmguGn0", | |
transfer_group: "notes_328324" | |
}) | |
# Send $4 to one account | |
transfer = Stripe::Transfer.create({ |
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
charge = Stripe::Charge.create({ | |
amount: 1000, # The total amount of the charge | |
currency: "usd", | |
source: "src_1BF7yx2jy8PDLWD6TFmguGn0", # A token representing the customer's payment details | |
destination: { | |
amount: 900, # The amount the connected user gets | |
account: "acct_1BF8VRBAxruRdpTq", # The ID of the connected user | |
} | |
}) |
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
# Retrieve the account | |
account = Stripe::Account.retrieve("acct_1BF8VRBAxruRdpTq") | |
# Grab the fields needed | |
fields_needed = account.verification.fields_needed | |
# ...later in your form, display an account update form based on the fields needed for verification | |
<% if fields_needed.include?('legal_entity.business_name') %> | |
<div class="form-group"> | |
<%= f.label :business_name, "Business name (as it appears to the IRS)" %> |
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
# Creates a Stripe account with some minimal account information submitted from a form | |
stripe_account = Stripe::Account.create( | |
type: "custom", | |
legal_entity: { | |
first_name: account_params[:first_name].capitalize, | |
last_name: account_params[:last_name].capitalize, | |
type: account_params[:account_type], | |
dob: { | |
day: account_params[:dob_day], |
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 subscription and take a 10% commission | |
subscription = Stripe::Subscription.create( | |
{ | |
customer: "cus_BcNDyG0NuHZn4i", # The ID of the customer on the connected account to charge | |
items: [ | |
{ | |
plan: "29_monthly" # The ID of the plan to which the customer will be subscribed | |
} | |
], |
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 customer on a connected account | |
customer = Stripe::Customer.create( | |
{ | |
description: "Customer for [email protected]", | |
source: "src_1BF7yx2jy8PDLWD6TFmguGn0", # The secure token representing the payment details | |
}, | |
{ | |
stripe_account: "acct_j1cXUEAksEpalsjc3Xl3" # The ID of the Stripe account connected to your platform | |
} |
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 | |
} |
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
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
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) |