In the last episode, we made it possible to complete orders. As an e-commerce site, it does us very little good to complete an order if we don't also charge the customer for it. So let's add Stripe support in.

We've seen stripity-stripe before. Let's add it to our project:

vim mix.exs
def applications(_) do #... :stripity_stripe #... end def deps do #... {:stripity_stripe, "~> 1.2.0"} end
mix deps.get

Alright, the next thing to do is to configure it. I've got my Stripe test environment variable set up already, we'll use it in the config:

vim config/config.exs
config :stripity_stripe, secret_key: System.get_env("STRIPE_SECRET_KEY")

Alright, so to charge a card is pretty easy. We'll set up a test that actually charges the customer, verify it works, and then set out to TDD the building of the arguments that we send to stripity-stripe ultimately.

We'll let the register take care of charging for the order as well as turning the cart...