Skip to content

Instantly share code, notes, and snippets.

@alexanmtz
Last active February 21, 2017 14:36
Show Gist options
  • Save alexanmtz/6343fd6b4ea710faa9b2723a667d8c1c to your computer and use it in GitHub Desktop.
Save alexanmtz/6343fd6b4ea710faa9b2723a667d8c1c to your computer and use it in GitHub Desktop.
Paying a order with application fee and connected account on stripe
# Set your secret key: remember to change this to your live secret key in production
# See your keys here: https://dashboard.stripe.com/account/apikeys
Stripe.api_key = "sk_test_BQokikJOvBiI2HlWgH4olfQ2"
Stripe::Order.create(
:currency => 'usd',
:email => '[email protected]',
:items => [
{
:type => 'sku',
:parent => 'sku_6yK573OC7bNAX0'
}
],
:shipping => {
:name => 'Jenny Rosen',
:address => {
:line1 => '1234 Main Street',
:city => 'Anytown',
:country => 'US',
:postal_code => '123456'
}
},
{:stripe_account => '{CONNECTED_STRIPE_ACCOUNT_ID}'}
)
order = Stripe::Order.retrieve('or_6yLD5jBXsLYNcr',
:stripe_account => '{CONNECTED_STRIPE_ACCOUNT_ID}')
order.pay(
:application_fee => 100,
:source => 'tok_16glHpJrQulZCT9iNFY21k34'
# Obtained with Stripe.js ^^^
)
// https://stripe.com/docs/elements/examples
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment