Stripe Connect with React and API only Rails - ruby-on-rails

I'm having some issues with Stripe Connect. I have an API only backend in Rails and a frontend in React. I have successfully created Connect Accounts for new businesses which register in my frontend. However when a customer wants to buy something from the business, the payment doesn't work.
I create a Stripe::PaymentIntent in my rails backend when the frontend calls /business/payment_secret and return the client secret which is provided by the Payment Intent. The frontend then calls stripe.confirmCardPayment with the given client secret and the card which was used in the form. However, I always get "No such payment intent" error.
I've read somewhere that I need to add the stripeAccount config to the stripe object which is plugged into Elements. I tried to plug in the stripe account id of the business the customer is purchasing from but it didn't work.
Also it was very awkward to create the stripe object which has the business the customer is purchasing from can change depending on which items the user adds to the cart. Is there a standard way of doing that?
Or how does the payment process for connected accounts look like with an API only backend and a react frontend?
Thanks in advance

You need to review the various charge types to determine which fits your business needs, combined with the account type(s) you're using.
It sounds like you might be creating "direct charge" payment intents using the stripe-account header on your server then trying to confirm them in the client without that. You'll need to initialize Stripe.js using the same stripeAccount option.
The issue you're referring to with multiple potential accounts is one to think about in your customer flow. What if a customer wants to buy two items from two different connected accounts? For that flow you'd need to change your integration to use separate charges and transfers.

Related

Allow user to input financial information for stripe express account?

I'm trying to build a Patreon-like app: A creator creates an account where users can then subscribe for some price.
I have gotten to the point in my code where I now need the user to add his bank info into stripe so he can receive funds. I have come across questions like this, and this, but neither shares any information on how a user can input his bank info on the client-side (they only deal with the backend).
The connected accounts are Express accounts.
How do I make the user add banking information on the client-side?
I have been recommended this stripe page but it does not show how to allow a creator to input banking info on client-side. I have also implemented the example backend code from firebase and updated it for my specific case.
Update:
I've also come across this page about Managing bank accounts and debit cards but it appears to be for custom accounts not express.
Stripe uses a hosted onboarding page for Express accounts. It's basically a form hosted on a Stripe domain that handles all the common onboarding requirements (e.g. verification documents and bank account details) needed.
Once the user has filled everything in they are redirected back to your site/app. In other words you don't really have to worry about collecting bank details client side, Stripe does it for you: https://stripe.com/docs/connect/express-accounts

How to send payment to the customer from Stripe account using API in Rails?

One of my client Ruby on Rails project have a functionality of get payment from customer in his stripe account.
Now, He needs to pay that payment to the item owner after deducted commission. So, how we can pay from stripe account to particular customer account using API in Rails?
I have checked many API's but not clear which exactly use for it.
Any one have a idea or experience in it?
Thanks
See the Stripe guide on Using Checkout with Rails.
I am not positive if a customer token can be used to send funds to, but if so or not, the following still applies.
If the customer has a connected account (or customer token), you can then use "transfer" to transfer the funds to them.

ios Stripe payment(Account to Account Transfer)

I am making an application in Objective-C(iOS). I want to transfer some amount from my account to the other account using my application.
Case: The transfers will be user specific.
1.There will be a user who will post his need for money.
2.The other person who wants to help him will contact him in personal chat.
3.There will be a payment option from where the donator will send money to the person in need.
Please help if anybody is having knowledge about it, as I haven't worked with stripe before.
Thanks in advance.
The first step would be setting up Stripe
https://www.youtube.com/watch?v=NdszUvzroxQ
The tutorial uses Heroku which handles the backend side of the payments.
Here is the documentation https://devcenter.heroku.com
Just incase you're looking for a way to do this with Firebase, check out my answer here Swift Firebase Stripe Connect
The next step would be altering your Stripe project to work for Stripe Connect
The documentation for Stripe connect is here https://stripe.com/docs/connect
You basically need to setup your account to allow for users to sign up as 'Connected accounts' that can receive payments. Your stripe account takes the payment and then dishes out to the connected account accordingly, it needs to be setup in the node server.
Stripe has an example project that uses Stripe connect which is what you're looking for, this handles marketplace style payments.
Take a look at their project. The concept is that users can sign up online and be accepted for payments.
Here is the project https://github.com/stripe/stripe-connect-rocketrides
and the demo website https://rocketrides.io

Stripe Create User Function in Swift

I was just wondering if there was a simple function to create a customer in the Stripe API from my app in Swift? Instead of having to create a manual HTTP post request to my server, "createCustomer.php", and then retrieve the results (This is what I do right now).
I tried to search this up on Google, but I can't seem to find anything. I simply want the user to save their card details for later user, that's why I am in need of creating a customer.
Thanks in advance!
Except for payment information tokenization (which is done via Stripe's iOS or Android SDKs in mobile apps, and Checkout or Stripe.js in web apps), all API requests must be sent from a backend server.
The reason is that aside from token creation, all other API requests must be sent using your secret API key. You cannot embed or share the secret API key with your mobile app in any way, as it would then be possible for an attacker to retrieve it and use it to issue API requests on your behalf.
This is why there is no Swift function to create a customer -- the customer creation must be done from your backend, using the server-side language of your choice.

Accepting payment on behalf of someone else

I have organizations who have users that pay to join. I need to be able to accept payments on my rails app and send the money(minus a potential charge that goes to me) to the organization's bank account.
Currently I have only found services to accept payments(fee #1) and then separate services that distribute payments(fee #2). I am looking for a service that is easy to implement and combines these steps; preferably wrapped up in a nice ruby gem.
I suggest Stripe, I've implemented it before, the documentation is very clean and the gems worked fine
How you could use it:
Organizations needs to create an account on stripe
You will implement in your platform a way to organizations login on stripe through your platform, when they do that they will create a permission to your platform to receive payment in their behalf
You can set a value you will receive for each transaction
Stripe will distribute the money automatically after each payment

Resources