1 00:00:00,370 --> 00:00:05,130 In the last section we started to talk about how we are going to allow users to enter credit card details 2 00:00:05,190 --> 00:00:06,570 into our application. 3 00:00:06,570 --> 00:00:11,640 We would then Bill our customers and then every time that they gave us one dollar we would give them 4 00:00:11,730 --> 00:00:13,560 one credit in return. 5 00:00:13,560 --> 00:00:18,480 Of course the amount of money that we collect for each individual credit is completely variable. 6 00:00:18,510 --> 00:00:21,410 And we can figure it out over time and it's really easy to tweak. 7 00:00:21,510 --> 00:00:27,150 But right now we're just going to say one dollar one U.S. dollar that is equals one credit. 8 00:00:27,150 --> 00:00:27,430 OK. 9 00:00:27,450 --> 00:00:30,650 So let's start to talk about billing how it's going to work with us. 10 00:00:30,690 --> 00:00:33,360 Some of the big challenges around it all that kind of good stuff. 11 00:00:33,360 --> 00:00:37,380 The last thing I want to point out on this mockup right here is remember that there's going to be this 12 00:00:37,380 --> 00:00:40,360 big button right here that says add credits. 13 00:00:40,390 --> 00:00:45,540 So the first thing you want to talk about is what happens when user clicks on add credits right here. 14 00:00:46,050 --> 00:00:46,420 All right. 15 00:00:46,440 --> 00:00:48,490 So we're going to move on over here. 16 00:00:48,810 --> 00:00:54,860 So every user clicks on add credits I want to show some type of credit card form to our users something 17 00:00:54,860 --> 00:01:00,270 and says hey please enter your name or the name on the credit card enter the credit card number and 18 00:01:00,270 --> 00:01:02,920 then when the user clicks submit right here that's pretty much it. 19 00:01:02,940 --> 00:01:06,870 We're then going to build their card and collect some money from them. 20 00:01:07,260 --> 00:01:12,360 So this gives us kind of a high level understanding of what we are going to expect to show to our actual 21 00:01:12,360 --> 00:01:13,880 users in our application. 22 00:01:14,130 --> 00:01:20,370 But what's going on behind the scenes here is far far more complicated of course it is like how could 23 00:01:20,370 --> 00:01:23,630 it not be everything here is complicated it seems like nothing is ever easy. 24 00:01:23,940 --> 00:01:24,880 Oh whatever. 25 00:01:24,900 --> 00:01:26,640 Let's talk about what's going on with the form. 26 00:01:26,850 --> 00:01:31,610 And before we do that let's talk about some general rules of thumb when we deal with billing. 27 00:01:32,240 --> 00:01:32,630 OK. 28 00:01:32,640 --> 00:01:38,040 So these are like rules of billing not necessarily you know you're not going to find this list published 29 00:01:38,040 --> 00:01:38,540 anywhere. 30 00:01:38,550 --> 00:01:44,480 Of course these are my recommendations to you having set up payment on several apps in the past. 31 00:01:44,640 --> 00:01:49,590 So these are my general recommendations to you things to just keep in mind that will kind of give you 32 00:01:49,590 --> 00:01:53,890 a sense of why things work the way they do around billing. 33 00:01:54,410 --> 00:01:54,690 OK. 34 00:01:54,720 --> 00:01:57,230 So first point here we are about at security. 35 00:01:57,290 --> 00:02:03,000 And when I say we I'm talking about you I'm talking about me I'm talking about every other web developer 36 00:02:03,000 --> 00:02:03,660 out there. 37 00:02:03,780 --> 00:02:06,310 We are all awful at security. 38 00:02:06,390 --> 00:02:10,950 Like for example even in this course we've gone through that Heroku deployment but we haven't really 39 00:02:10,950 --> 00:02:16,710 had a lot of talk about real security around our application right like we've deployed something and 40 00:02:16,710 --> 00:02:20,910 we haven't really even given a second thought to security. 41 00:02:20,910 --> 00:02:24,770 So hey maybe everything is secure right out of the box maybe your application is fine. 42 00:02:24,870 --> 00:02:30,410 But you know what maybe it's not maybe our Heroku deployment does have some issue in it maybe there's 43 00:02:30,420 --> 00:02:35,460 some issue where someone could get access maliciously to our back end database. 44 00:02:35,550 --> 00:02:39,450 We really don't know because we haven't spent enough time to handle that kind of stuff. 45 00:02:39,570 --> 00:02:42,570 And that's really what it all comes down to it's all about time. 46 00:02:42,630 --> 00:02:47,630 No one really has enough time or money to throw out throw out all these security issues. 47 00:02:47,640 --> 00:02:49,260 So here's how we get around it. 48 00:02:49,300 --> 00:02:56,130 Here's how we deal with the fact that you and I and everyone else are all bad at handling security. 49 00:02:56,160 --> 00:03:01,850 Number one you and I never accept raw credit card numbers. 50 00:03:01,860 --> 00:03:06,840 Now you might look at that first point right there and then think back to the form of the mock up I 51 00:03:06,840 --> 00:03:11,370 just showed you this right here where I said Oh yeah let's take the credit card number right here like 52 00:03:11,370 --> 00:03:16,220 literally on this form two seconds ago I showed you a form that had some credit card input. 53 00:03:16,230 --> 00:03:19,760 So you're probably thinking OK like Stephen whatever. 54 00:03:19,770 --> 00:03:21,870 Well just bear with me on this first one. 55 00:03:21,870 --> 00:03:24,970 Once I show you the payment processor that we're going to make use of. 56 00:03:25,080 --> 00:03:26,580 You'll understand what I'm talking about. 57 00:03:26,820 --> 00:03:29,520 So just keep in mind right now just accept this. 58 00:03:29,520 --> 00:03:36,420 Just say we are never going to accept rock credit card numbers being sent directly to our server like 59 00:03:36,450 --> 00:03:41,030 our back and server are back in database and it goes very closely with number two on here. 60 00:03:41,070 --> 00:03:45,880 You and I are never ever going to manually store credit card numbers. 61 00:03:47,380 --> 00:03:51,490 Instead we are always going to use an outside payment processor. 62 00:03:51,490 --> 00:03:57,160 So some outside API some outside company who has gone through all the trouble of setting up all this 63 00:03:57,160 --> 00:04:00,880 building infrastructure in all the web security around it. 64 00:04:00,940 --> 00:04:06,580 So the general idea here because you and I are bad at web security we are never going to handle the 65 00:04:06,580 --> 00:04:09,730 very low level raw payment details. 66 00:04:09,820 --> 00:04:15,580 Instead we're going to rely on some outside company to take care of all this stuff for us. 67 00:04:15,580 --> 00:04:20,680 Now for this application and I highly recommend using this company for your own personal apps in the 68 00:04:20,680 --> 00:04:21,700 future as well. 69 00:04:21,730 --> 00:04:26,240 We're going to be making use of an outside payment processor called Strype. 70 00:04:26,650 --> 00:04:34,660 So in a new browser tab I'm going to navigate to Strype dot com so Strype handles accepting credit cards 71 00:04:34,990 --> 00:04:40,840 they make doing payments they make credit cards all this kind of stuff really easy very simple straight 72 00:04:40,840 --> 00:04:41,760 out of the box. 73 00:04:41,830 --> 00:04:46,450 And the best part of all of it is that they take care of all the security related items. 74 00:04:46,780 --> 00:04:52,270 And so you and I never have to worry about the fact that we are about security and we can just let streite 75 00:04:52,510 --> 00:04:57,520 do its thing take care of credit cards take care of payments for us and they're going to essentially 76 00:04:57,520 --> 00:05:02,030 tell us hey some user over here just paid you $10 or something like that. 77 00:05:02,050 --> 00:05:06,880 So the entire payment process is really going to be pushed off to the street vendor which is going to 78 00:05:06,880 --> 00:05:09,130 make our lives far easier. 79 00:05:09,160 --> 00:05:12,300 So we don't have to deal with any new security issues. 80 00:05:12,400 --> 00:05:16,700 So that's big rule number one remembering that we are bad at security. 81 00:05:16,720 --> 00:05:24,130 Now big point number two billing is heart billing is hard billing is challenging even with a fancy vendor 82 00:05:24,220 --> 00:05:24,970 like stripe. 83 00:05:25,000 --> 00:05:29,150 You know even with this fancy payment processor They're like a billion dollar company. 84 00:05:29,170 --> 00:05:34,480 They go out of their way to make sure that billing is as easy as possible even with a service like stripe 85 00:05:34,870 --> 00:05:38,970 billing still ends up being somewhat challenging. 86 00:05:38,980 --> 00:05:46,020 So point number one in here you might be thinking to yourself OK Stephen what's with all these like 87 00:05:46,030 --> 00:05:50,170 credit things I've been saying you know I've said like when to use user adds money we're going to assign 88 00:05:50,170 --> 00:05:53,500 them credits or you might be thinking Stephen that's lame. 89 00:05:53,500 --> 00:05:58,990 I want to figure out how to do like a SAS type application where we bill someone monthly. 90 00:05:59,410 --> 00:06:02,680 Well yeah of course that would be a little bit more interesting. 91 00:06:02,680 --> 00:06:03,660 I agree with you. 92 00:06:03,850 --> 00:06:04,760 But here's the thing. 93 00:06:04,780 --> 00:06:06,360 Billing is hard. 94 00:06:06,460 --> 00:06:11,610 Accepting monthly payments like that is far more challenging than you might think for example. 95 00:06:11,620 --> 00:06:15,850 And here's just like one tiny example I'm going to throw out there just to give you a sense of why I 96 00:06:15,850 --> 00:06:17,440 say that billing is hard. 97 00:06:17,440 --> 00:06:21,850 Let's imagine that our application has two plans they have. 98 00:06:21,850 --> 00:06:22,570 We have two plans. 99 00:06:22,570 --> 00:06:28,550 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 100 00:06:28,570 --> 00:06:29,950 surveys a month. 101 00:06:29,950 --> 00:06:35,650 So let's imagine that someone signs up for the 50 survey a month plan they'd give us like you know $10 102 00:06:35,740 --> 00:06:42,490 whatever it is and we say OK here we go here's 50 service and then about a week later the customer comes 103 00:06:42,490 --> 00:06:46,900 back to us and they say hey you know what it turns out we actually want that hundred survey plan. 104 00:06:46,900 --> 00:06:50,310 Can you charge us more money and give us that plan instead. 105 00:06:50,590 --> 00:06:54,580 Well now all of sudden we have to ask ourselves like this is one week into it. 106 00:06:54,580 --> 00:07:00,250 And maybe they've used like 40 of their allotted surveys and they want to now migrate to the more expensive 107 00:07:00,250 --> 00:07:00,930 plan. 108 00:07:01,120 --> 00:07:06,970 So tell me exactly how you're going to charge your user are you going to charge them like a fraction 109 00:07:07,030 --> 00:07:09,120 of the surveys they've already used. 110 00:07:09,190 --> 00:07:12,940 Where is it going to be a fraction of the time that they've been on the platform. 111 00:07:13,180 --> 00:07:16,120 How much money is that going to actually translate to. 112 00:07:16,120 --> 00:07:21,310 So whenever we start doing these like monthly type plans and we've got multiple tiers life starts to 113 00:07:21,310 --> 00:07:25,300 get really challenging much more quickly than you would expect. 114 00:07:25,390 --> 00:07:31,480 And because of this I really recommend that whenever you're putting your own application together you 115 00:07:31,480 --> 00:07:38,380 try to figure out a way to avoid monthly payments if possible it's going to help you right out of the 116 00:07:38,380 --> 00:07:40,530 box with a lot of billing support. 117 00:07:40,540 --> 00:07:44,650 A lot of buildings set up and a lot of code related around all these issues. 118 00:07:44,650 --> 00:07:50,710 If you try to think of a way inside of your application to make like a one time payment or a pay as 119 00:07:50,710 --> 00:07:54,540 you go kind of deal your life is going to get a lot easier. 120 00:07:54,550 --> 00:07:55,900 I mean think about our application. 121 00:07:55,900 --> 00:07:57,420 It's simple as can be. 122 00:07:57,430 --> 00:08:02,290 You give us money we give you credits when you run out of credits you pay us more money. 123 00:08:02,590 --> 00:08:07,060 There's no questions about what happens when you want to do an upgrade halfway through a month. 124 00:08:07,060 --> 00:08:11,500 There's no questions about what happens when you run out of credits and then need to upgrade to the 125 00:08:11,500 --> 00:08:12,270 next plan. 126 00:08:12,580 --> 00:08:17,350 Well there's no question about what to do with the credit or number of surveys that user has available 127 00:08:17,710 --> 00:08:19,530 when they have downgraded their plan. 128 00:08:19,550 --> 00:08:26,510 You know Sunis so many of these issues just start to go away when you simplify your billing process. 129 00:08:26,590 --> 00:08:31,540 Now the other thing that is really hard around billing is that fraud in chargebacks are a pain. 130 00:08:31,600 --> 00:08:36,640 So as soon as you start accepting credit cards inside of your application it goes without saying that 131 00:08:36,640 --> 00:08:41,320 eventually one of your users are going to submit a credit card that is either fraudulent. 132 00:08:41,380 --> 00:08:47,140 So it might be a stolen credit card or your user might decide later on that they paid you and you gave 133 00:08:47,140 --> 00:08:50,830 them like you know survey credits or whatever it might be. 134 00:08:51,040 --> 00:08:55,770 And then at some point when the user gets the bill their credit card bill they say oh you know what. 135 00:08:55,810 --> 00:09:00,420 I didn't actually mean to pay these people or these people charge me the wrong amount. 136 00:09:00,490 --> 00:09:05,110 And so they might file a chargeback which essentially tells their credit card company you don't pay 137 00:09:05,110 --> 00:09:06,200 these people. 138 00:09:06,250 --> 00:09:08,730 So dealing with this stuff it is not fun. 139 00:09:08,770 --> 00:09:12,380 It's a pain really just a hassle overall. 140 00:09:12,460 --> 00:09:18,130 You can really save yourself a lot of trouble by simplifying your billing system inside your application 141 00:09:18,160 --> 00:09:21,980 or simplifying what your user is paying for as much as possible. 142 00:09:22,210 --> 00:09:27,550 And I'm saying this not to give you like theoretical guidance I'm saying this as someone who has built 143 00:09:27,550 --> 00:09:33,080 these payment things in the past and has jumped through crazy crazy hoops just to get payments working 144 00:09:33,080 --> 00:09:35,270 the way you expect. 145 00:09:35,270 --> 00:09:35,570 OK. 146 00:09:35,600 --> 00:09:41,240 So the last thing I want to see about billing specifically around doing like monthly plans and stuff 147 00:09:41,240 --> 00:09:42,200 like that. 148 00:09:42,230 --> 00:09:46,760 Yes we could have in theory you know gotten through all this stuff in the course I could have said OK 149 00:09:46,790 --> 00:09:52,220 well we'll just have one monthly plan and we'll just make it happen even if we went down that path. 150 00:09:52,280 --> 00:09:56,540 You know even if we decided let's just do a single plan we'll do monthly but still keep it as simple 151 00:09:56,540 --> 00:09:57,550 as possible. 152 00:09:58,010 --> 00:10:03,770 As soon as you start to get into the realm of monthly payments inside of your application a lot of outside 153 00:10:03,770 --> 00:10:09,070 services that exist to help you with monthly payments actually cost money. 154 00:10:09,170 --> 00:10:11,220 And they have no free tier. 155 00:10:11,300 --> 00:10:16,670 So a great example of this might be like recurrently I'm not sure I can spell it right from the get 156 00:10:16,670 --> 00:10:18,180 go. 157 00:10:18,520 --> 00:10:23,680 Curly he is a recurring payment subscription platform. 158 00:10:23,750 --> 00:10:27,850 So they are built on top of stripe so you can still use stripe with Rick curly. 159 00:10:27,860 --> 00:10:32,800 They just have a series of helpers for making monthly billing or kind of recurrent recurring payments 160 00:10:32,810 --> 00:10:34,030 work a lot easier. 161 00:10:34,250 --> 00:10:38,150 And so approach with a lot of these is that they'll say like try it free but that's always going to 162 00:10:38,150 --> 00:10:44,960 be a kind of you know it says very clearly right here you're paying money and then try it free so to 163 00:10:44,960 --> 00:10:46,390 sign up for a lot of services. 164 00:10:46,400 --> 00:10:48,340 You have to put in your credit card from the get go. 165 00:10:48,380 --> 00:10:53,360 And obviously in the context of a course like we're in right now I don't want to tell you right now 166 00:10:53,560 --> 00:10:58,580 OK pull out your credit card and sign up for this or you don't you can't finish the course. 167 00:10:58,580 --> 00:11:00,570 And so even in the context of the course. 168 00:11:00,710 --> 00:11:04,430 So I want to make sure that you know as we go through the billing stuff it's still something that you 169 00:11:04,430 --> 00:11:07,030 can get through even if you don't put in a credit card. 170 00:11:07,190 --> 00:11:12,350 And of course Strype which we are using doesn't require you to put a credit card in from day one because 171 00:11:12,350 --> 00:11:17,290 you can sign up in a permanent free trial type type of like test mode. 172 00:11:17,870 --> 00:11:18,230 OK. 173 00:11:18,290 --> 00:11:21,860 So I think that's enough about some of the rules around billing and some of the considerations around 174 00:11:21,860 --> 00:11:26,080 billing and kind of the considerations within this course even around it. 175 00:11:26,090 --> 00:11:28,310 So I think that's enough about billing for now. 176 00:11:28,310 --> 00:11:31,550 I think you've got a good idea of some of the concerns. 177 00:11:32,060 --> 00:11:36,380 So at this point you're probably still sitting here thinking OK Stephen we're not accepting credit card 178 00:11:36,380 --> 00:11:40,320 numbers but you're telling me right here that we are accepting your credit card number. 179 00:11:40,340 --> 00:11:42,170 So let's get to the next section. 180 00:11:42,170 --> 00:11:46,340 We're going to talk a little bit about what stripe does for us and we're going to talk about exactly 181 00:11:46,370 --> 00:11:51,960 how we are going to kind of obey these rules as we make use of the strike payment platform. 182 00:11:51,980 --> 00:11:52,530 OK. 183 00:11:53,060 --> 00:11:54,940 So I'll see you in the next section.