#damonstrr

1 messages · Page 1 of 1 (latest)

unborn grottoBOT
winged skiff
#

Hi 👋 it looks like that flow is setting the stripe_account header

thorny sundial
#

using rails pay gem i tried setting it but it rejects it for some reason.

winged skiff
#

Sorry, there was supposed to me more to that, hit enter too soon. Longer message is on the way.

#

When you do that, you're using a flow that we refer to as a Direct Charge, because the payment is happening directly on the Connected Account.

When using Direct Charges, the Checkout Session you're creating is created on the Connected Account, and therefore can only interact with other objects on the Connected Account. If you try to pass the ID of a Customer that does not belong to the Connected Account (for instance, one that belongs to another Connected Account, or your Platform Account) then you will encounter a "no such object" error.

#

Can you share the ID of a request where you encountered the error you mentioned? That ID should start with a req_ prefix.

thorny sundial
#

i tried doing this

@checkout_session = current_user.payment_processor.checkout(
  mode: 'subscription',
  locale: I18n.locale,
  line_items: [{
    price: 'price_1ILVZaKXBGcbgpbZQ26kgXWG',
    quantity: 4
  }],
  subscription_data: {
    trial_period_days: 15,
    metadata: {
      pay_name: "base" # Optional. Overrides the Pay::Subscription name attribute
    },
  },
  success_url: root_url,
  cancel_url: root_url,
  # Add the selected Stripe account to the header
  header: {
    'Stripe-Account' => selected_stripe_account
  }
)

it does not work

#

I want a customer to be able to subscribe to multiple stripe connect account

#

req_gmvjnqfTZd0jjV

winged skiff
#

Yup, you're trying to reference a Customer object that resides on another account, that is not allowed.

To accomplish what you're after, you will need to either:

thorny sundial
#

That means that all product prices will be on the platform and not the connect account right??

winged skiff
#

For Destination Charges, yes, that is correct. For the second option I proposed above, you would still create the Prices/Products on the Connected Accounts.

thorny sundial
#

Just to ask do you have an idea of how do the second option using rails pay gem.

winged skiff
#

I don't, I'm pretty sure that integration is built by a third-party, which we're not familiar with in this forum. We focus on providing assistance for the Stripe API in general and our official first-party libraries.

unborn grottoBOT
thorny sundial
#

Quick question: Is it possible that connect account product price (plan) be used for the checkout api and the money initially transferred to the platform and the platform then transfer the money to the connect account??

What do you call this way?

subtle mountain
#

Hello! I'm taking over and catching up...

thorny sundial
#

Okay @subtle mountain

subtle mountain
subtle mountain
#

Yes, that's what I was responding to.

#

What type of connected accounts are you using?

thorny sundial
subtle mountain
#

Sounds like you're using direct charges, so you have Standard connected accounts?

#

Oh.

#

So you're not using direct charges?

#

We do not recommend using direct charges with Express accounts.

#

With Express accounts you would want the Destination charges tab on the page I linked you to.

thorny sundial
#

Okay give me a sec trying to modify my code please

#

with this

# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://dashboard.stripe.com/apikeys
Stripe.api_key = 'sk_test_26PHem9AhJZvU623DfE1x4sd'

session = Stripe::Checkout::Session.create({
  line_items: [{
    price: '{{PRICE_ID}}',
    quantity: 1,
  }],
  payment_intent_data: {
    application_fee_amount: 123,
    transfer_data: {
      destination: '{{CONNECTED_ACCOUNT_ID}}',
    },
  },
  mode: 'payment',
  success_url: 'https://example.com/success',
  cancel_url: 'https://example.com/failure',
})

# 303 redirect to session.url

the price is the platform price yeah??

#

because i tried using the the connect account price it gives me no such price

subtle mountain
#

Yeah, for destination charges all of the payment objects live on your platform.

subtle mountain
#

Yes.

#

The payment will happen on your platform, and a Transfer will be made to the connected account for a portion of the total.

thorny sundial
#

I was thinking of allowing connect account to create product/price instead but since it can't be done on express account i guess it's fine

subtle mountain
#

You can create a UI for your connected accounts to do that on your platform if you want.

thorny sundial
#

How is that done??

#

Is there a documentation??

subtle mountain
#

No, it's something you would need to build on your own.

thorny sundial
#

I know but how will the price go to my platform account??

#

Will i use the normal product create api??

#

without attaching the stripe_account header rught??

subtle mountain
#

Yeah, you would build a UI that would use the Stripe API behind the scenes to create the Product/Price on your platform account.

thorny sundial
#

okay, so no way the connect account can see customers??

subtle mountain
#

What do you mean?

thorny sundial
#

Like no way the connect account can see who paid and who subscribed??

subtle mountain
#

Not by default, no. You can build a UI to show them that though.

#

They would be able to see that in the Stripe Dashboard if you were using Standard accounts and direct charges though.