Welcome back.
Now, what we need to do is that we need to get the payments table.
And looking at the payments the table, you need to open the database and then you need to click on
Escorial.
And then I'm going to use you all to clear the table.
So I'm going to paste this.
So this card is going to clear the table.
So let me explain this code.
This this code is going to create the payments table where there will be four columns.
The first column is payment ID and the payment ID is going to be a integer of 11 digits and it's going
to be auto and it's going to be auto increments.
So it's going to be unique.
And then we will have the order ID, the user ID, the transaction I.D. The primary key is the payment
ID.
If you want to use this code, you need to pause the video right now and type this code.
So again, you need to pause and type this in your excuse.
I'll just pause the video and type this command create table if not exists, payments, payment, ID,
etc. So all of this code, you need to type this code and once you are done, just click on go and this
is going to get you the table and you should find the table here.
Among your tables.
As you can see inside a database, you will find that we have a new table now called Payments.
If you click on it, you will find that here.
If you click on this structure, you'll find the structure.
We have payment ID, order I.D., user I.D. and transaction I.D. make sure that payment ID is auto increment.
This is very important.
That's it.
Now we have this payments table.
Now we can use this payments table to complete our store payments.
So let me now there over to the project and work on this.
So not only the project, as you can see, we continued, we finished this record.
I finished working on this, which is complete payment.
Leave me now.
This, this good.
So what I'm going to do is that I'm going to start the process from scratch.
So I'm going to create a new order.
I'm going to go back to the home.
Or alternatively, I can be for an order that I already have.
So as you can see, I have so many orders.
For example, Amy.
You're paying for this order.
Let me click on details.
And here, let me click on paying now.
So if I click on pay now A the PayPal button will be displayed right here.
As you can see, pay a victim payment.
PayPal payment, but only me.
Click on it and they will be connected to PayPal and I need to log in first.
So again, you need to log in with the with the buyer account that you created and then click on next
and then you need to type the password.
And then click on login.
So I should be get 405.
So here I can see 405.
So let me now you let me now you as my balance, do pay.
I'm going to click on pay now and here it says Processing.
And as you can see, what I'm going to get here is that I'm going to get on air.
This is a very, very common error, this error, even though this area is basic.
Many developers fall into this type of error.
So let me show you how to fix this here.
So now remember in the complete basement, that Peachtree here, I said location account that.
However, the account is outside the server.
Therefore we need to say that got and then therefore slash and then account that beach.
This is very important.
Let me click on file at least one more time.
So I'm going to go back and then I'm going to pay for another order.
Let me go back.
And here it is paid.
But it did not redirect me to the correct page to limit this one more time.
I'm going to click here on details and then I'm going to pay for this.
Let me click on pay now and here.
LME now paying for this order.
And as you can see, it was beat successfully and it took me through the speech.
As you can see, it's as you picked paid here.
This order was paid and this order was paid.
But the problem is that we still need to display a success message.
So let's work on displaying a success message.
So in the account here, after we take the user to the account page, we have this valuable payment
message.
So we need to display this payment message.
So in the account, I'm going to open the account.
And then in that count, what I'm going to do is that above above this.
We're going to show you exactly where I'm going to explain the message.
I'm going to explain the message here.
Specifically here.
So here, let me show you where it's going to be displayed.
So I'm going to take your message and then I'm going to save and refresh to show you the location.
So if I refresh here, the message will be displayed here.
But we need to fix the design.
So let me let me here say a glass and then margin top.
Five.
And I'm going to also say text center.
So let me refresh.
And it will be displayed here.
So the message will be displayed here.
So to do this, to display the message we need to use it's BHP.
I'm going to sit here, BHP and then.
Here.
First, we need to check.
I'm going to say if.
If what if gets.
Well, because this is a get payment message.
A set first a set is set gets.
Payment.
Underscore message.
Message.
If we have this message, then clearly.
Brackett And then we need you to open another BHP and then we need to say we need to close the contract
and then I'm going to copy this B paragraph and then I'm going to pass it between you in between.
And what I'm going to do is that I'm just going to add your space to show you the big block of gold,
which is this here.
All you need to do is that you need to say BHP and then echo.
And then get.
Get.
Payment message, payment, underscore message and then semicolon.
And make sure that the payment message key is equal to this one payment message.
Make sure that you don't have any typos.
So let's now test another time.
So to test one more time, let me first refresh.
And here, as you can see, it says paid successfully.
So the reason is because I'm still in the same page.
But let me also add the color to this message.
I'm going to say.
I'm going to say style.
Color.
Green.
Because this is a success message.
Let me now go back and be for people one of these orders so we have better.
I'm going to click on details and then pay now.
And then I'm going to click on PayPal and let me pay for this order.
Let me click on.
They now?
And as you can see, it's going to stay here successfully.
Thanks for your shopping with us.
And if you scroll, you'll find that the order here, it says.
The process was successful.
And if you click on details, you should never find the pay now button because this order was paid already.
So it's great.
Now it's great.
And you as the you as the owner, you have control over displaying the status so you can now if an order
is paid, if in the database you find if you go to the database and check the orders and find that an
order was paid, you can start shipping that order to the user.
So if you find you need of course, you need to monitor your orders regularly.
And then if you find that an order was paid, you can start shipping it and you can change the status
from B to shipped or delivered.
And it will be it will automatically be displayed to the user.
So for example, if you are the owner and if you changed this to shift, for example, if you say you
shipped.
And if you update this now in the in my account as the customer here is going to say shift so the customer
will know whether the order was shipped or not.
And if it's delivered, you need to say here, delivered, delivered.
And of course, of course, the user will will have received by that time, the user will have received
the order, as you can see, delivered regarding this message.
As soon as you go out, as soon as you go away from this page and go back to your account, the message
will never be displayed again, which is great.
So the system now, repayment system now is complete.
Finally in the payments.
In the payments, if you click on payments, you should find that the order was as you can see, the
order was why the payment was stored.
So the payment to your payment ID, the order ID and the user ID.
So the user I.D. is one?
That's correct.
The order I.D. is five six.
And then you can verify this by going through the orders.
So order number five, paid order.
Number six, paid order number ten paid.
And I changed this to delivered for the transaction ID.
The transaction ID is given by PayPal.
So you cannot you can change this.
It's given by PayPal.
By PayPal.
Besides the transaction ID, it could be a number, it could be a screen, it could be a combination
of numbers and strings.
So you shouldn't change this.
PayPal is going to give you this transaction ID and you need to get the transaction I.D. here from the
get request.