#damonstrr
1 messages · Page 1 of 1 (latest)
Hi 👋 it looks like that flow is setting the stripe_account header
using rails pay gem i tried setting it but it rejects it for some reason.
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.
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
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:
-
leverage Destination Charges, where all the payments happen on your Platform account and then funds are transferred to your Connected Accounts. This will allow you to create a Customer one time on your Platform account, and then use it for all of the payments processed on your Platform.
https://stripe.com/docs/connect/destination-charges -
Build a flow that creates Customers on your Platform account, and then uses copies their key details and payment method details to your Connected Accounts so you can process Direct Charges on those accounts.
https://stripe.com/docs/payments/payment-methods/connect#cloning-payment-methods
That means that all product prices will be on the platform and not the connect account right??
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.
Just to ask do you have an idea of how do the second option using rails pay gem.
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.
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?
Hello! I'm taking over and catching up...
Okay @subtle mountain
You can use Stripe Checkout with Connect, yes. We have a guide here: https://stripe.com/docs/connect/creating-a-payments-page
Yes, that's what I was responding to.
What type of connected accounts are you using?
express
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.
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
Yeah, for destination charges all of the payment objects live on your platform.
for express account right?
Yes.
The payment will happen on your platform, and a Transfer will be made to the connected account for a portion of the total.
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
You can create a UI for your connected accounts to do that on your platform if you want.
No, it's something you would need to build on your own.
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??
Yeah, you would build a UI that would use the Stripe API behind the scenes to create the Product/Price on your platform account.
okay, so no way the connect account can see customers??
What do you mean?
Like no way the connect account can see who paid and who subscribed??