Welcome back.
So now it's time to start integrating people into our project.
And the first step is that you need to log into your developer PayPal account and then we need to select
one of the options.
So first of all, you need to know that in order to integrate people into your project, there are so
many options and I'm going to be using an option called checkout.
So you need after you log in, you need to click on docs, just hover over it and then here click on
Get Started here, click on Get Started and after you click on Get Started, just click on accept payments,
accept payments and then click on checkout.
So this is the method that I'm going to be using is called check out, and this method is going to allow
us to receive payments from customers.
So after you click on check out, just click on set up standard payments, click on it.
And as you can see, this method is going to allow us to add a button that we can customize and add
the the the amount of money that we want to receive from customers.
And all you need to do now is that you need to click on integrate PayPal checkout for online payments.
Click on it.
And here it's going to give you a very long steps here, a very long guide.
But the problem with PayPal is that it's very complicated.
Therefore, I'm going to make the process very easy for you by just dividing the steps into short and
easy steps.
So the first step is that here in this page, all you need to do is that we need to get a good piece
of code that's going to generate the button that you have that you have seen shortly, which is this
button.
That code is going to generate that button into our website, into our project, and then we will be
able to receive payments from our customers.
Before I continue, you need to know that people regularly and consistently changes the location of,
of this of the, of, of this method in their website.
So you need to sometimes you might not find it here, so you need to look for it.
You need to click again on dock's and then get started and then look for it.
But it's the method is called checkout and then just set up standard payments are then integrate.
Now the first step is that we need to get the code from PayPal.
So the code is this code.
This is the code.
Let me show you.
Where does it go?
This is the code.
The code starts from here, so you need to start copying from here to this script and all the way down
to the end of the script.
You need to scroll and copy all of this good news.
You need to copy all of this code.
Let me copy all of this.
Good.
We copy all of this code.
So we need to get all of this.
Let me copy it.
So we need this code.
Don't copy.
Don't copy the other parts.
Just copy something from the script all the way to the end of the script.
Copy it.
Just copy it.
And then you need to hand it over to your project and paste it.
And I'm going to show you where you need to paste because you of course, you shouldn't paste it any
at any file.
You need to paste it at a specific location.
So now in my in my project, what you need to do is that you need to open up the payment dot B2B payment
again, that's payment that B2B.
And then where should you pasted.
You should pasted above the footer, above the future.
That would be here.
You should paste it here.
Just paste that code here.
So now we have this good.
So this is the first step.
So again, the first step is to get this this code is going to generate the button that you have seen.
The second step.
Is that two?
Is that going to get the client ID?
So where should we get the client it?
We should we should get the client from the from our from your account.
So let me hit it over back to the to the PayPal.
So in PayPal, just say the over again to your account and log in and then click on your project, the
project that you are using for this, the project that you have created for this project.
So I'm going to click on it.
So once you click on it, you will find the sandbox account and the client ID.
You need to copy your client I.D. and heading over back to the to the to the to the project.
So let me copy let me copy my client I.D..
Now in your project, you need to pace the client, but we should you based it.
You should base it here.
And instead of this test.
Here it is.
Client hyphen ID is equal to test, so we need to remove this test.
I'm based based here.
Based here?
Your client.
As you can see, this is my client.
Again, you need to be very careful because if you get this wrong, it's not going to work again.
Double check your client and make sure that you copied your client ID correctly and pasted your client
I.D. client like it is equal to you.
Were delighted that you pasted.
This is very, very important.
Now what I'm going to do is that I'm going to show you and I'm going to walk you through the record
is like this the u r l is just going to connect people with u r l that contains your client a d and
then below this we have here a dev.
We need to move this dev, but I'm going to let me do this because it's going to take a little bit of
time and you need to understand it.
Here we have this script.
So this script has a people.
It connects to the people and it uses this function called buttons.
This function is going to be the button and this function is going to have a value key.
And that value is the amount of money that you will receive.
And we need to change this amount depending upon the total amount that the user should pay us.
And then we have an approved function.
This function will be called if we get the if we if the payment has been processed successfully, we
will get here a a data from the people telling us that payment was processed successfully and money
was transferred from the from the customer to our account.
And in case of error, also, this is going to handle errors in case we have any errors here, this
is going to handle any problems.
Now, let me show you the button.
So the button is this is this.
So what I'm going to do is that first I'm going to copy this dev and then I'm going to remove it from
here.
And then.
I'm going to paste it here.
I'm going to paste it here just for now.
I'm going to be here for now.
Now let me head on over to the browser.
So now there in the browser let me go to four.
Slash B meant that beach B and if you go to payment that beach B, you should find the bottom.
If you if you can't find the button, then then there is a problem.
But you should find the button as long as you follow the steps that I show that they have shown you,
you will find a button.
And as you can see, this is the button.
So now as you can see, the button is being displayed even though you here it says you don't have an
order.
Therefore we need to fix this.
So let me show you how we can fix this.
To fix this, what we need to do is that instead of displaying our button, remember this input, which
is our button, we can comment about an out.
We no longer need a button.
I'm going to comment the button out.
And instead I'm going to paste people's button.
I'm going to be this good.
I'm going to paste this good.
So, Laney, here, copy it again.
Let me copy it from here and then remove it from here.
And then we need to place it in two locations.
We need to base it here.
And we need to sit here.
So we need to sit here because here.
Here first in the first if statement.
This means that the court is is not empty here.
It means that the user wants to pay for an order that they made earlier.
So here, only here.
We need to display the we need to display babelsberg leaving.
Let me now save and hit it over back to the browser and test.
Now in the browser, if I refresh the button will be gone because the button will only be displayed
in case we have something in the cart.
So let's add something to the cart real quick.
So I'm going to go back to the homepage and now in the home page, I'm going to add something to the
cart such as this.
And then I'm going to click on Add to Cart.
Then I'm going to click on check out and I'm going to fill out this form.
So if you fill out this form and click on place order, the order will be will be placed in case you
are logged.
In case you are logged in, but am not logged in.
So let me log in first.
And then I'm going to go to the checkout page.
And from the checkout lane, he fell to the floor one more time, and then I'm going to click on Place
Order.
Now, if I click on Place Order, guess what?
Now we have PayPal's button being displayed here and it looks amazing.
Now the button is being displayed and here it says total payment.
So the user will be able to pay now if they click on it.
But of course we still need to handle a few things before this.
This button becomes fully functioning because we need to tell people, hey people, we want the user
to pay this amount because this because people now doesn't know about this amount yet.