In the last section we started to talk about how we are going to allow users to enter credit card details
into our application.
We would then Bill our customers and then every time that they gave us one dollar we would give them
one credit in return.
Of course the amount of money that we collect for each individual credit is completely variable.
And we can figure it out over time and it's really easy to tweak.
But right now we're just going to say one dollar one U.S. dollar that is equals one credit.
OK.
So let's start to talk about billing how it's going to work with us.
Some of the big challenges around it all that kind of good stuff.
The last thing I want to point out on this mockup right here is remember that there's going to be this
big button right here that says add credits.
So the first thing you want to talk about is what happens when user clicks on add credits right here.
All right.
So we're going to move on over here.
So every user clicks on add credits I want to show some type of credit card form to our users something
and says hey please enter your name or the name on the credit card enter the credit card number and
then when the user clicks submit right here that's pretty much it.
We're then going to build their card and collect some money from them.
So this gives us kind of a high level understanding of what we are going to expect to show to our actual
users in our application.
But what's going on behind the scenes here is far far more complicated of course it is like how could
it not be everything here is complicated it seems like nothing is ever easy.
Oh whatever.
Let's talk about what's going on with the form.
And before we do that let's talk about some general rules of thumb when we deal with billing.
OK.
So these are like rules of billing not necessarily you know you're not going to find this list published
anywhere.
Of course these are my recommendations to you having set up payment on several apps in the past.
So these are my general recommendations to you things to just keep in mind that will kind of give you
a sense of why things work the way they do around billing.
OK.
So first point here we are about at security.
And when I say we I'm talking about you I'm talking about me I'm talking about every other web developer
out there.
We are all awful at security.
Like for example even in this course we've gone through that Heroku deployment but we haven't really
had a lot of talk about real security around our application right like we've deployed something and
we haven't really even given a second thought to security.
So hey maybe everything is secure right out of the box maybe your application is fine.
But you know what maybe it's not maybe our Heroku deployment does have some issue in it maybe there's
some issue where someone could get access maliciously to our back end database.
We really don't know because we haven't spent enough time to handle that kind of stuff.
And that's really what it all comes down to it's all about time.
No one really has enough time or money to throw out throw out all these security issues.
So here's how we get around it.
Here's how we deal with the fact that you and I and everyone else are all bad at handling security.
Number one you and I never accept raw credit card numbers.
Now you might look at that first point right there and then think back to the form of the mock up I
just showed you this right here where I said Oh yeah let's take the credit card number right here like
literally on this form two seconds ago I showed you a form that had some credit card input.
So you're probably thinking OK like Stephen whatever.
Well just bear with me on this first one.
Once I show you the payment processor that we're going to make use of.
You'll understand what I'm talking about.
So just keep in mind right now just accept this.
Just say we are never going to accept rock credit card numbers being sent directly to our server like
our back and server are back in database and it goes very closely with number two on here.
You and I are never ever going to manually store credit card numbers.
Instead we are always going to use an outside payment processor.
So some outside API some outside company who has gone through all the trouble of setting up all this
building infrastructure in all the web security around it.
So the general idea here because you and I are bad at web security we are never going to handle the
very low level raw payment details.
Instead we're going to rely on some outside company to take care of all this stuff for us.
Now for this application and I highly recommend using this company for your own personal apps in the
future as well.
We're going to be making use of an outside payment processor called Strype.
So in a new browser tab I'm going to navigate to Strype dot com so Strype handles accepting credit cards
they make doing payments they make credit cards all this kind of stuff really easy very simple straight
out of the box.
And the best part of all of it is that they take care of all the security related items.
And so you and I never have to worry about the fact that we are about security and we can just let streite
do its thing take care of credit cards take care of payments for us and they're going to essentially
tell us hey some user over here just paid you $10 or something like that.
So the entire payment process is really going to be pushed off to the street vendor which is going to
make our lives far easier.
So we don't have to deal with any new security issues.
So that's big rule number one remembering that we are bad at security.
Now big point number two billing is heart billing is hard billing is challenging even with a fancy vendor
like stripe.
You know even with this fancy payment processor They're like a billion dollar company.
They go out of their way to make sure that billing is as easy as possible even with a service like stripe
billing still ends up being somewhat challenging.
So point number one in here you might be thinking to yourself OK Stephen what's with all these like
credit things I've been saying you know I've said like when to use user adds money we're going to assign
them credits or you might be thinking Stephen that's lame.
I want to figure out how to do like a SAS type application where we bill someone monthly.
Well yeah of course that would be a little bit more interesting.
I agree with you.
But here's the thing.
Billing is hard.
Accepting monthly payments like that is far more challenging than you might think for example.
And here's just like one tiny example I'm going to throw out there just to give you a sense of why I
say that billing is hard.
Let's imagine that our application has two plans they have.
We have two plans.
We've got a plan where you can send out 50 or 50 surveys a month and a plan or you can send out 100
surveys a month.
So let's imagine that someone signs up for the 50 survey a month plan they'd give us like you know $10
whatever it is and we say OK here we go here's 50 service and then about a week later the customer comes
back to us and they say hey you know what it turns out we actually want that hundred survey plan.
Can you charge us more money and give us that plan instead.
Well now all of sudden we have to ask ourselves like this is one week into it.
And maybe they've used like 40 of their allotted surveys and they want to now migrate to the more expensive
plan.
So tell me exactly how you're going to charge your user are you going to charge them like a fraction
of the surveys they've already used.
Where is it going to be a fraction of the time that they've been on the platform.
How much money is that going to actually translate to.
So whenever we start doing these like monthly type plans and we've got multiple tiers life starts to
get really challenging much more quickly than you would expect.
And because of this I really recommend that whenever you're putting your own application together you
try to figure out a way to avoid monthly payments if possible it's going to help you right out of the
box with a lot of billing support.
A lot of buildings set up and a lot of code related around all these issues.
If you try to think of a way inside of your application to make like a one time payment or a pay as
you go kind of deal your life is going to get a lot easier.
I mean think about our application.
It's simple as can be.
You give us money we give you credits when you run out of credits you pay us more money.
There's no questions about what happens when you want to do an upgrade halfway through a month.
There's no questions about what happens when you run out of credits and then need to upgrade to the
next plan.
Well there's no question about what to do with the credit or number of surveys that user has available
when they have downgraded their plan.
You know Sunis so many of these issues just start to go away when you simplify your billing process.
Now the other thing that is really hard around billing is that fraud in chargebacks are a pain.
So as soon as you start accepting credit cards inside of your application it goes without saying that
eventually one of your users are going to submit a credit card that is either fraudulent.
So it might be a stolen credit card or your user might decide later on that they paid you and you gave
them like you know survey credits or whatever it might be.
And then at some point when the user gets the bill their credit card bill they say oh you know what.
I didn't actually mean to pay these people or these people charge me the wrong amount.
And so they might file a chargeback which essentially tells their credit card company you don't pay
these people.
So dealing with this stuff it is not fun.
It's a pain really just a hassle overall.
You can really save yourself a lot of trouble by simplifying your billing system inside your application
or simplifying what your user is paying for as much as possible.
And I'm saying this not to give you like theoretical guidance I'm saying this as someone who has built
these payment things in the past and has jumped through crazy crazy hoops just to get payments working
the way you expect.
OK.
So the last thing I want to see about billing specifically around doing like monthly plans and stuff
like that.
Yes we could have in theory you know gotten through all this stuff in the course I could have said OK
well we'll just have one monthly plan and we'll just make it happen even if we went down that path.
You know even if we decided let's just do a single plan we'll do monthly but still keep it as simple
as possible.
As soon as you start to get into the realm of monthly payments inside of your application a lot of outside
services that exist to help you with monthly payments actually cost money.
And they have no free tier.
So a great example of this might be like recurrently I'm not sure I can spell it right from the get
go.
Curly he is a recurring payment subscription platform.
So they are built on top of stripe so you can still use stripe with Rick curly.
They just have a series of helpers for making monthly billing or kind of recurrent recurring payments
work a lot easier.
And so approach with a lot of these is that they'll say like try it free but that's always going to
be a kind of you know it says very clearly right here you're paying money and then try it free so to
sign up for a lot of services.
You have to put in your credit card from the get go.
And obviously in the context of a course like we're in right now I don't want to tell you right now
OK pull out your credit card and sign up for this or you don't you can't finish the course.
And so even in the context of the course.
So I want to make sure that you know as we go through the billing stuff it's still something that you
can get through even if you don't put in a credit card.
And of course Strype which we are using doesn't require you to put a credit card in from day one because
you can sign up in a permanent free trial type type of like test mode.
OK.
So I think that's enough about some of the rules around billing and some of the considerations around
billing and kind of the considerations within this course even around it.
So I think that's enough about billing for now.
I think you've got a good idea of some of the concerns.
So at this point you're probably still sitting here thinking OK Stephen we're not accepting credit card
numbers but you're telling me right here that we are accepting your credit card number.
So let's get to the next section.
We're going to talk a little bit about what stripe does for us and we're going to talk about exactly
how we are going to kind of obey these rules as we make use of the strike payment platform.
OK.
So I'll see you in the next section.