So it's time to test the transaction.
We have our currency showing our properly on the page and we're ready to actually try to run a transaction.
So if you look at Stripe Dash, just partial, you'll see that I have a couple of mistakes.
And I blame them on a lack of caffeine, but I make mistakes all the time.
So the first one is right here on line sixty for I am fetching.
And instead of putting the API in there, the route to the API, I have the publishable key.
So let's get rid of that.
And instead let's put an API, which we're getting from the render package right here as part of the
default data.
And we have it called API here.
OK, so that's the first mistake.
And of course that has to have some API payment dash intent after it because the API is just a localhost
column, four thousand and one.
So that's the first mistake and the second problem.
I just transpose these, I put the API in the publishable key.
Now if you go to our handlers and you look at virtual terminal right now, I'm handing that to the virtual
terminal using a string map and that works.
But down here in this handler, I'd also have to hand that to this charge once, page.
And if I have to do it twice, chances are there's an easier way to do it.
So what I'm going to do is delete this out of here, which means I'm not handing any data to this template
at all so I can delete everything inside the curly brackets after a template data.
OK, and instead I'll add that to my default data.
So it's available any time I want.
So let's get rid of these blank spaces and let's go to render Dutko and add two new fields here.
I'll call the first one stripe secret key, which would be a string and also have not string supercute
stripe secret key.
And I'll also have stripe publishable key which will also be a string OK and a formatters.
And then down here in the add default data I'll just populate that on every request stripe.
Secret key will be equal to app dot config dot straight dot.
And this is the secret key.
So I want the secret and then I'll popularity dot stripe publishable key which will be equal to update
config dot stripe dot key there.
Now if this is decompiled and it did that's good.
That means I need to go back to just partial and fix this.
And here I want the stripe publishable key, which is now available any time I want it straight publishable.
She.
OK, so let's save this, make sure it compiled and it did.
Let's go back to our Web browser, reload this page, go to the console, clear the console, and let's
try running a transaction.
So cardholder name, Jack, nimble cardholder email.
Jack, that nimble dot com and credit card is our standard visa that always passes.
Let's see if we got this right.
Twenty nine.
Three, three, three.
OK, so we'll charge the card.
And they're so we've got a transaction going through now, we're not done yet, but we've actually successfully
charged our test credit card on our test stripe account.
So if you think this through, we actually don't want to just put this payment succeeded form up.
We actually want to do more on the back end.
We actually want to store the transaction in the database and we actually want to pull that widget out
of the database as well.
So there's more work to do.
So we'll get started on that in the next lecture.
But right now, we've managed to get this form working properly and corrected my goofy error that I
made when I transposed the API and the secret key in straight charges.
But everybody makes mistakes.