#Erik Magnusson
1 messages · Page 1 of 1 (latest)
Does your code correctly set the Stripe-Account header? (see https://stripe.com/docs/connect/authentication#adding-the-connected-account-id-to-a-client-side-application) - since this is a PaymentIntent created on one of your connected accounts you can't just use your platform's publishable key and expect it to work
You need your platform's publishable key in addition to the stripe-account for this
Ok. Did not know that.
For the react native tab it says that I need to use the stripeAccountId when I initiate the StripeProvider. I have a for a lot of different connected accounts. Is it possible to change this programatically at runtime?
So no I've tried to:
- initiate the StripeProvider using a connected account id, and my platforms publishable key. (the react native example of your link)
- setting up a a payment intent on the server to initiate the payment sheet in the app.Using this setup:
`
const stripe = require('stripe')('sk_test_4QHS9UR02FMGKPqdjElznDRI');
const paymentIntent = await stripe.paymentIntents.create(
{amount: 1000, currency: 'usd', automatic_payment_methods: {enabled: true}},
{stripeAccount: '{{CONNECTED_ACCOUNT_ID}}'}
);
`
Still getting:
"message": "Ingen sådan customer: 'cus_NX2aWK2qer2PzU'", "stripeErrorCode": "resource_missing"
Oh wait.
Now it says customer 🙂
^^ yeah that probably means you're using a customer that's on the platform instead of the connected account
Some questions.
For each time I want to make a direct charge.
Do i have first have to create a user and a payment method on the connected account?
The payment sheet seems to handle the creating of the payment method if it does not exists.
And if that's the case. I the same customer wants to but something from the same connected account again. Do I have to store the user that exists on the connected account to use it for the next charge?
Or can I reference the customer in my platform to that of the connected account? Otherwise it's a lot of logic just to keep track of user that should exist on connected accounts
hey there, just reading all of the above, give me a few minutes
Hey, just to fill in.
I'm now created a customer on the connected platform
But when i try to create the intent I get:
Error: No such customer: 'cus_NX3agXUQPWcUzu'
Yes, if you're using direct charges, the payment method needs to be on the connected account, an the customer if used
You can clone card payment methods to your connected accounts if you have them saved at the platform level:
https://stripe.com/docs/payments/payment-methods/connect#cloning-payment-methods
Yes I've tried this. But there's multiple questions going on now:
- Is there a reason to creata a user on my platform I all I'm gonna do this use direct charges and then take platform cut?
- If I have to create customers on the connected account, do I have to store them indivudially myself so that I can reference them in following direct charges between the same user and connected platform. Or can I just opt to create a new user everytime I create an intent, even if the user already exists on the connected account.
- When creating an intent for a direct charge, I've now initiated the StripeProvider as instructed by the docs(using the connect account id and my platforms pk), on the server i initiate the stripe sdk with my pk. I create a user on the connected platform and then try to create the intent for a direct charge. In the dashboard I can see that the user is created, but when tyring to create the intent it says that there are no such customers
1/ if this is destined for single connected account usage, no. you can create it directly on the connected account if you like.
2/ either works. You can attach the cloned PM to a customer on the connected account then re-use it, or you can re-clone it each time. If you expect re-use, customer attachment is probably tidier.
3/ Do you have an example of this? There's likely a mismatch in account contexts.
I have a req id: req_WslQX4A89wgVGw
Yes, that customer exists on one of your connected accounts, not your platform
You can only use it with direct charges on that account
acct_1..yAW
I'm creating a direct charge payment intent for the same connected account I create the user on
Or, I'm trying to
Ok, I got it to work. Had it initiate both the react native sdk and the server sdk with the connected account accounts id
Yep, that's right
The example request was on your platform, not using a connected account context
Another question.
How do i go about using direct charge for subscriptions?
And, is there an easy way to fetch all payment made to all connected accounts it has made direct payments to by an email ref?
That's covered here, it's more or less the same: https://stripe.com/docs/connect/subscriptions#use-direct-charges-to-create-a-subscription
You create the subscription using the account header, then confirm the invoice payment intent using Stripe.js with your publishable key & the connected account just as with a non-invoice payment intent
No, there's no way to get that for direct charges across multiple accounts, you'd need to track that separately
Great. Thanks for your help!
NP!