fuentesloic / nuxt-stripe

MIT License
90 stars 8 forks source link

Changing programmatically stripeAccount #30

Open Thomashh2k opened 4 months ago

Thomashh2k commented 4 months ago

It would be a nice Feature if it would be possible when initializing stripe with an connect account

await useClientStripe({ stripeAccount: 'acct_.....'})

If a contribution for a feature like this is needed i would like to help.

Best regards

flozero commented 4 months ago

hey @Thomashh2k thanks a lot for the message. Is it something you actually need already ? Of course if you have any time to spend on something like this and if this is something that other users needs lets do it. Would be nice if we can have some thumbs up on your comment if its needed

Thomashh2k commented 4 months ago

Hi @flozero first of all thanks for the fast reply. Indeed it is something that my Project needs. I had locally edited source code of the Project but had Problems to use npm link

This can also be useful for others as an example if you want to make a platform where you have a type of users where they have a StripeConnectAccount so you could pay them out when the End-Customer pays for some goods or services

In my example i have StripeCustomers that are linked to StripeConnectAccounts. From the StripeCustomers i am collecting IBANs with StripeElements on the Frontend-Side. After that i am making a StripePaymentMethod, which i need to Link to a StripeCustomer in the space of a StripeConnectAccounts My backend, of course, failed because I couldn't use a StripePaymentMethod which was created only with my client key In my will be often change the stripeAccountId when ever some one uses a different Account on my app

I will be forking it and make a pull request out of it The change is minimal in the Source code

I hope the text wasnt that horrible. I rarely write in english

flozero commented 4 months ago

That is great i understand. I guess we are missing a doc on how to contribute. I would suggest you to use pnpm and try with the playground don't hesitate to ask questions if you need help on the setup etc

Thomashh2k commented 4 months ago

Okay i was testing right now a bit....

I never made a Nuxt Module so there some things i needed to find out apperantly i can only call await useClientStripe({ stripeAccount: 'acct_test12345'}) once and the id acct_test12345 stays on the Nuxt Page it only could be changed when visiting a different Page

I moved app.vue to pages/index.vue

nuxt config had the id: acct_test123

/index (await useClientStripe()) = acct_test123 /test(await useClientStripe()) = acct_test12345

As i said everytime i tried to save the return of useClientStripe the id from before stayed the same

I already did a pull request only with the change in useClientStripe if you could tell what i am missing out i would appreciate it https://github.com/fuentesloic/nuxt-stripe/pull/32

flozero commented 4 months ago

will have a look this weekend and see whats missing