Welcome back.
Now it's time to tell people.
Hey, people.
We want you to take this amount of money which is here in this case, in this example, it's 155.
And then we need to tell people, hey, people, we want you to let the user pay 155 because people
doesn't know about this.
This number this number is being displayed by our application.
Not by people.
And people doesn't know about it.
So let's now do this.
Let's still feel terrible about this number.
So how can we do this?
Let me show you how we can do this.
So now in our project, in order to tell people, hey, people, we have this amount, we need to find
where the amount is.
So where is the amount?
The amount, first of all, is this.
Remember, the amount is stored.
Is a story in the session is stored in the session total or in the total in the order total price.
It's either one of them.
So we need to get this data.
We need to give them and display them here.
Display them here and it's the best value.
And before we do this, we have to.
But before we do this, we need to decide whether we want which one we are going to be using.
So how can we do that?
To do that, we need here in case in case the in case the cart in case the user wants to pay after they
added something to the cart.
Then here, after echoing after echoing here, what we want to do is that we need to create here another
record here, BHP.
And then in this BHP code we need to say.
Amount is going to be equal now to the session.
Session and then total.
Similarly here, in case in case the user came from their account, we need to display the same exact
goods.
BHP.
Amount is equal to boss.
Order.
To tell.
Price or order total price.
And it's very important to know that people want this number as a string.
So we need to convert this into a string.
I'm going to say is the.
Is the SDR.
Val this value.
They're not going to pay.
I'm going to pass the.
I'm going to pass this into it.
Similarly here, I'm going to say here is the ah Val.
And then I'm going to pass the value into it.
So now we have this amount.
This amount will be used in the script.
Now we can use it in the script to tell people about the money that the user must be.
So here, as you can see, we have this 77.
So instead of saying 77, we need to remove this 77.
And instead we need to use B2B, we need to say B2B, and then we need to say echo amount, amount and
then semicolon.
That's it.
Very, very simple.
And then click on Save.
So again, let me explain this one more time, because I think you might have gotten confused.
So here again, if the user came from the cart, first we need to check that.
We need to make sure that the cart is not empty and that it is not empty and it's not zero either.
And then we at this point, we can get the total and then we can store the total in a variable called
amount.
And then we need to convert it to a string using the SDR function.
And in case user came from the there they are their account because they want to pay for an order that
they have created earlier.
We can we should use the order total price and store it in a valuable amount.
And by the way, here it's better also to check the to check that the order the order total price is
not empty, but it's it's 99% is going to be it's 99%, but 99.9% are not going to be empty because
it's related to the order status.
Whenever we have an order, it means we it orders that it is not paid.
Then there is a number associated with it.
So this is just an extra step you can add.
But I'm not going to add it here.
Here, I'm going to just sort of evaluating the amount.
And then lastly here, in case, of course, the buttons will be displayed in both cases.
Otherwise, there is no button.
So we don't have to worry about anything if there if there is no order.
And then in people's could we just display this amount?
We place this amount rather than the static amount.
Now people know about the value from us.
Now people know that this amount is the amount of the that the customer should be pretty simple.
And then here, upon clicking on the button, this amount will be paid by the user.
And here on approve.
If the amount has been approved approved successfully, then PayPal is going to return a few things
and we can continue.
And by the way, we can here say alert people already has a code.
By the way, it's the other transaction.
So we don't have to worry about this either.