raj
raj

Reputation: 6094

Create an order on behalf of SKU owner automatically with stripe connect

In this example when an order is created in stripe and payment is made, the money goes to the api key owner.

require "stripe"
Stripe.api_key = "sk_tes*******"

Stripe::Order.create(
  :currency => 'usd',
  :items => [
    {
      :type => 'sku',
      :parent => 'sku_7GgX4LQpE5Y3Go'
    }
  ])

I would liketo have the money transferred to the owner of the sku so that I dont have to make different Order.create when sku of different owners are included in the items array.

I know I can pass a stripe_account hash to create order on the behalf of the owner. But is it possible to make the order on behalf of the owner of SKU without mentioning stripe_account hash? By that I mean stripe looks at the SKU and creates the order on behalf of the SKU owner.

Thanks.

Upvotes: 1

Views: 1009

Answers (2)

raj
raj

Reputation: 6094

To help someone with the same doubt. When you are building an ecommerce website which uses stripe connect for creating a marketplace , stripe provides an easy way to create Products,Skus,Orders,etc for the connected account . All you have to do is , pass uid of the connected account with the stripe create command. ie, {stripe_account: <uid of connected account>}.

Upvotes: 0

Matthew Arkin
Matthew Arkin

Reputation: 4648

You'd have to pass the stripe_account hash to the create order api call. As without it Stripe would attempt to just create the order in your account, and there is no restriction in Stripe to say that the id of a SKU can't belong to multiple accounts.

Upvotes: 0

Related Questions