Swift Stripe Saving Card Integration - ios

I have recently developed an iOS application using swift that does the basic Stripe functionality as mentioned in the Stripe example. However, my app requires saving card details with payment being made at certain times in the system. I am aware that a customer object needs to be created, store the id and then charge in reference to this id. My issue is when using the server side code provided by Stripe I am unable to create a customer or charge. If anyone has any suggestions that would be most appreciated!

I have also had this issue when I first started to use Stripe.
The first thing I did was to review the standard Stripe integration guide to make sure all the dependencies were added to the pod file, that they were installed, and that I had deployed to a backend in my case Heroku and then added the backend base url in the CheckoutViewController.
I also checked to make sure that my ViewControllers had the proper target membership selected.
I also made sure the app delegate had the Stripe publishable key added in the func didFinishLaunchingWithOptions.
Once I did all that I was able to process a purchase from my app on my device and see a new customer, a new credit card, and a new charge in my Stripe Dashboard.
EVENT
cus_C4jHIFBjr12qoy was charged $1.99
Customer cus_C4jHIFBjr12qoy added a new MasterCard ending in 4444
cus_C4jHIFBjr12qoy's details were updated
cus_C4jHIFBjr12qoy is a new customer
I am also able to add additional credit cards during a session, but I still have not figured out how to retrieve an existing client id from the backend or stripe so I can retrieve stored credit cards so the user does not have to reenter the credit card information every time they use the app.
A good resource to check out is : http://webchat.freenode.net to see what other developers are doing to integrate Stripe into their apps.
Here is a link to a YouTube Video on Stripe which you may find useful:
Part 1 https://www.youtube.com/watch?v=NdszUvzroxQ&t=233s
there is also a Part 2 which actually shows how to create charges and configure the backend. Hope this helps.

Related

Stripe Connect with React and API only 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.

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 Connect payment in iOS

We want to integrate Stripe Connect with iOS application to transfer amount from one person to person.
Let's say, I want to transfer $100 to my sister's account using Stripe Connect Standalone/Managed Account. And we also want to take business commission from sender which includes stripe commission also.
We have gone through Sharing Customers also but won't be able to find any solution for Stripe Connect with iOS SDK.
We have also checked iOS SDK.
Can anyone please guide us how to integrate Stripe Connect with iOS mobile app in above scenario?
How can we transfer payment to end customer?
Do we need to integrate through iOS SDK or web page?
Stripe's iOS and Android SDKs serve the same purpose in a mobile application as Checkout or Stripe.js do in a web application: they take payment information and produce a token in return.
Once the token has been created, it must then be sent to a backend server where it can be used in API requests sent with the secret key. You can't create charges or transfers directly from your mobile app -- that must be handled by an external server.
(Also, please note that there might be compliance issues with what you're trying to do. I recommend you reach out to Stripe's support to explain your usecase and make sure it's something that Stripe can support.)
You can easily integrate Stripe Connect with your iOS app check the following link
https://github.com/gurunglaxman0/StripeConnect-iOS
Once you connect your stripe user id with server you can create charges and application fee using Stripe Api's from backend

Stripe managed account - wrong country

We are creating a marketplace, we are using stripe for payments and we are creating stripe managed accounts for our users when they register. We are trying to prevent anything that could go wrong and I am thinking scenarios that could mess up things and how we need to handle them.
I was wondering how would you handle a user who selected wrong country when he registered and the stripe managed account on your platform was created with the wrong country? According to stripe documentation you can't change the country of a managed account later. Do you just drop and re-create the stripe managed account? What if the managed account has received funds from a charge and the user find out the problem later?
I would say the best and the only way to handle this is to drop and re-create like you said.
If he was able to receive funds, this is not a problem. You can refund anyway if you need to. Just keep every charge / bank transfer in your database.
I don't see why it could be a problem, you can re-associate the bank account easily for example.

Integrating Paypal Rest SDK into Rails app --

I'm a fairly new developer and this is my first time integrating a rest API with an app. The goal is to implement a subscription process where a user can select from a choice of 4 subscriptions and then submit a payment through Paypal or stripe, but I'm struggling to understand how PayPal's rest API works. I've read their documentation and looked at some examples which gave me an idea of where to start. However, I had a few questions that I couldn't seem to find the answer to online:
Are subscription plans that are created through the rest API permanently associated with the account they have been created on?
If they are permanent, how can I avoid hardcoding the Plan ID? This seems like bad practice even though it is done in some of the examples.
When should I be generating new tokens? Every time they expire? Every time a user wants to subscribe to a plan?
How do I automatically execute agreements after they have been created? (I assume executing the agreement is what makes it active and begins the collection of payment).
Thanks, it would be nice to get some clarification on some of this stuff.

Resources