Skip to content

Instantly share code, notes, and snippets.

@matthewarkin
Created September 3, 2014 19:11
Show Gist options
  • Save matthewarkin/8043e9a7f5d3ccf18f7f to your computer and use it in GitHub Desktop.
Save matthewarkin/8043e9a7f5d3ccf18f7f to your computer and use it in GitHub Desktop.
Stripe transfer customers
Read through the Stripe Connect Getting Started Guide.
https://stripe.com/docs/connect/getting-started
Create a Stripe Connect App in your dashboard.
Get a Stripe connect code from for the account you want to transfer customers to
Then get an access token using that account (instructions in the getting-started guide).
Sweet, now we can make API calls on the account we are transfering customers to.
Read through the Shared Customers doc. https://stripe.com/docs/connect/shared-customers
Here's some psuedo code:
foreach Stripe_Customer customer in CustomersIWantToTransfer
cardToken = Stripe::Token.create(
{:customer => customer.id},
ACCESS_TOKEN # user's access token from the Stripe Connect flow
)
//create a new customer in the stripe account you are transfering to.
//link them with cardToken to transfer over the card
Stripe::Customer.create(
{:email=> customer.email, :description => customer.description,
:card=> cartToken}.
ACCESS_TOKEN
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment