In segment 4.5 we'll talk about payment services. Thus far we've talked about how you can store and manage your Bitcoins. Now we're gonna talk about how a merchant can accept payment in Bitcoins in a practical way. So the scenario here is that we have a merchant. Maybe it's an online seller of some kind of goods or services. Maybe it's a local retail merchant, and they wanna be able to receive payments in Bitcoins. Now the reason they wanna be able to receive payments in Bitcoins, let's say, is not that the merchant is so excited about Bitcoins, but simply because their customers wanna be able to pay in Bitcoins. What the merchant wants is to receive dollars or local fiat currency, whatever that is, at the end of the day. They wanna have some way of receiving payments in Bitcoins which is easy for them to deploy, so they don't have to worry a lot about technology changing their website or building some kind of point of sale technology. And they also want low risk. There are various risks associated with receiving payments in Bitcoins. And the merchant doesn't wanna have to worry about those, so they don't wanna have to worry about technology risk. That is, the risk that by changing their technology something will go wrong, their website will go down, something will malfunction, and that will cost them money. They don't wanna security risks of handling Bitcoins, the possibility that someone will break into their hot wallet, or some employee will make off with their Bitcoins. And they don't wanna deal with the exchange rate risk, that the value of a Bitcoin in dollars may fluctuate from time to time. And the merchant who might wanna sell a pizza for $12 wants to know that they're gonna get $12 or something close to it, and that the value of the Bitcoin that they received in exchange for that pizza won't drop drastically before they can get it, before they can exchange those Bitcoins for dollars. So the merchant wants to be isolated from all of that. And so the reason that we have payment services is fundamentally to allow both of these parties to be happy and get what they want while someone else takes care of bridging the gap between these different desires. So the process by which a merchant might arrange to accept Bitcoin payments on their site through a payment service would work something like this. The merchant would first go to the payment services website, and they'd fill out a form that looks something like this. This particular form comes from a service called Coinbase. And so the merchant says, all right I want to display a button on my webpage. I want it to be a Buy Now button. I want the button to look like this. Here's the name of the item that is being bought. Here's the sale price amount, which can be in either Bitcoins, or dollars, or some other currency. And then here's where the funds should be sent when the customer buys. The merchant then, having filled that out, presses this button to generate button code, and out will come a bunch of HTML code that the merchant can just drop into their website. The merchant will put that into their website, and what will appear on the website to the customer will be a button that looks like whatever they chose. When the customer pushes that button, then a bunch of payment magic will happen, and the merchant will eventually get a confirmation saying that, yeah, a payment was made by this customer for Alpaca Socks in such and such amount. So the way that that actually works, or one typical way that the mechanism might work for a payment, is illustrated here. Here we have down at the bottom a user who wants to buy something from the merchant who's up here. And we have over here the payment service. Okay, so the user goes to the merchant's website. They shop, they pick out an item they wanna buy, and when it comes time to pay, the merchant will deliver a web page which will contain they pay with Bitcoin button, and it will contain some other information. It will contain a transaction ID, that is some identifier that is meaningful to the merchant in their own accounting system, along with an amount that they wanna be paid. And this will basically be the magic HTML code that was provided earlier by the payment service. The user, if they wanna pay with Bitcoins, will click that button. That will cause information to be sent to the payment services in HTTP, or HTTPS ideally, request which says that that button was clicked. Here's the transaction ID from the merchant, here's the amount, and of course the identity of the merchant is implicit here. When that happens, now the payment service knows that this customer, whoever they are, wants to pay a certain amount of Bitcoins. And so the payment service will pop up some kind of a box or do some kind an interaction with the user in which the user will receive information about how to pay, and the user will then initiate a Bitcoin transfer to the payment service. Once the user has created that payment, then the payment service will send back information. Might be a redirect of some kind, maybe an HTTP redirect or something else that comes back to the user's browser, and causes the user's browser to send a message on to the merchant from the payment service saying, it looks okay so far. And then later, the payment service will directly send a confirmation saying that yes, in correspondence with this transaction ID that you the merchant created the following amount was spent, that this is fully confirmed in the Bitcoin block chain, and the payment service will confirm that it's giving you the money at the end of the day. So once that happens, now the merchant knows that the payment is confirmed, and they can go ahead and allow whatever the item is that this user bought to be shipped out to the user. And then the user will eventually get the item, and everyone is happy. So this is a typical kind of flow. The details of the flow might work a little differently depending on which payment service you're using, but that's the idea. From the merchant's standpoint, what happens is, they include this blob of HTML in their website that eventually they get this tentative okay, things are going ahead, and eventually a firm confirmation from the payment service. They use this transaction ID to match up the purchase of this particular Snuggie by this particular user in their accounting system. And they use the confirmation to know they got paid. And now, the final step is the one in which the payment service actually gives money to the merchant. Okay, so the end result of this whole process is the following. That the customer pays Bitcoins some number of Bitcoins, that the merchant gets dollars. That's what the merchant wanted, they wanted to sell that item for a particular number of dollars or whatever their local fiat currency is. The merchant gets the number of dollars they asked for minus a small percentage. The payment service is going to take a small percentage as a fee, maybe a couple of percent. And the payment service does everything else. The payment service receives the Bitcoins that the customer paid. It pays out the dollars maybe at the end of every day. It makes a deposit into the merchant's bank account of all of the payments that came in that day. And of course it keeps a small percentage, and that's how it makes its profit. And the payment service absorbs all of the risks involved in this process. It absorbs the security risk, so it has to have good management of the Bitcoins, of its cold storage and all of that. It absorbs the exchange rate risk because it's receiving Bitcoins and paying out dollars. If the price of dollars against Bitcoins fluctuates wildly, the payment service might be unhappy. Then again, if it fluctuates wildly in the other direction, the payment service might be happy, but that risk, that uncertainty and absorbing it is part of what the payment service does. One thing to note here, is that the payment service, if it's operating at a large scale, is receiving large numbers of Bitcoins and paying out large numbers of dollars. And therefore, it's going to have a constant need to exchange the Bitcoins its receiving for more dollars. So that it they can keep this whole cycle going. And so, a payment service is going to be an active participant in the exchange markets that link together, in this case, the dollar economy and the Bitcoin economy. And that's another thing that they need to worry about. Not just what is the price of exchange, but how can we manage to exchange currency in this large volume? But in exchange for doing all of this stuff, the payment service gets their fee. And so this is potentially a lucrative business because it solves the mismatch between the customer's desire to pay Bitcoins, and the merchant's desire to just get dollars and concentrate on just selling goods.