1 00:00:00,900 --> 00:00:01,560 Welcome back. 2 00:00:02,010 --> 00:00:03,920 Now it's time to tell people. 3 00:00:03,930 --> 00:00:04,650 Hey, people. 4 00:00:04,890 --> 00:00:11,430 We want you to take this amount of money which is here in this case, in this example, it's 155. 5 00:00:11,910 --> 00:00:19,590 And then we need to tell people, hey, people, we want you to let the user pay 155 because people 6 00:00:19,590 --> 00:00:20,640 doesn't know about this. 7 00:00:20,880 --> 00:00:25,770 This number this number is being displayed by our application. 8 00:00:25,770 --> 00:00:27,030 Not by people. 9 00:00:27,510 --> 00:00:28,770 Not by people. 10 00:00:28,770 --> 00:00:30,270 And people doesn't know about it. 11 00:00:30,780 --> 00:00:32,850 So let's now do this. 12 00:00:32,880 --> 00:00:35,580 Let's still feel terrible about this number. 13 00:00:36,150 --> 00:00:37,110 So how can we do this? 14 00:00:37,140 --> 00:00:38,640 Let me show you how we can do this. 15 00:00:41,450 --> 00:00:47,000 So now in our project, in order to tell people, hey, people, we have this amount, we need to find 16 00:00:47,000 --> 00:00:48,170 where the amount is. 17 00:00:48,380 --> 00:00:49,400 So where is the amount? 18 00:00:49,910 --> 00:00:51,740 The amount, first of all, is this. 19 00:00:51,800 --> 00:00:53,930 Remember, the amount is stored. 20 00:00:55,170 --> 00:01:05,010 Is a story in the session is stored in the session total or in the total in the order total price. 21 00:01:05,010 --> 00:01:06,270 It's either one of them. 22 00:01:06,810 --> 00:01:08,730 So we need to get this data. 23 00:01:08,730 --> 00:01:11,610 We need to give them and display them here. 24 00:01:12,750 --> 00:01:14,940 Display them here and it's the best value. 25 00:01:34,380 --> 00:01:37,500 And before we do this, we have to. 26 00:01:38,700 --> 00:01:44,460 But before we do this, we need to decide whether we want which one we are going to be using. 27 00:01:44,850 --> 00:01:45,930 So how can we do that? 28 00:01:46,290 --> 00:01:55,830 To do that, we need here in case in case the in case the cart in case the user wants to pay after they 29 00:01:55,830 --> 00:01:57,030 added something to the cart. 30 00:01:58,140 --> 00:02:05,010 Then here, after echoing after echoing here, what we want to do is that we need to create here another 31 00:02:05,310 --> 00:02:07,290 record here, BHP. 32 00:02:08,040 --> 00:02:11,430 And then in this BHP code we need to say. 33 00:02:13,770 --> 00:02:18,450 Amount is going to be equal now to the session. 34 00:02:20,140 --> 00:02:24,340 Session and then total. 35 00:02:28,110 --> 00:02:36,780 Similarly here, in case in case the user came from their account, we need to display the same exact 36 00:02:36,780 --> 00:02:37,050 goods. 37 00:02:38,160 --> 00:02:38,730 BHP. 38 00:02:41,140 --> 00:02:45,760 Amount is equal to boss. 39 00:02:52,280 --> 00:02:52,910 Order. 40 00:02:54,230 --> 00:02:54,950 To tell. 41 00:02:57,370 --> 00:02:59,590 Price or order total price. 42 00:03:00,160 --> 00:03:04,150 And it's very important to know that people want this number as a string. 43 00:03:04,150 --> 00:03:06,130 So we need to convert this into a string. 44 00:03:06,130 --> 00:03:08,290 I'm going to say is the. 45 00:03:11,360 --> 00:03:14,330 Is the SDR. 46 00:03:16,660 --> 00:03:19,150 Val this value. 47 00:03:19,600 --> 00:03:20,170 They're not going to pay. 48 00:03:20,200 --> 00:03:21,060 I'm going to pass the. 49 00:03:22,030 --> 00:03:23,860 I'm going to pass this into it. 50 00:03:24,370 --> 00:03:29,320 Similarly here, I'm going to say here is the ah Val. 51 00:03:30,910 --> 00:03:33,430 And then I'm going to pass the value into it. 52 00:03:42,410 --> 00:03:43,700 So now we have this amount. 53 00:03:44,090 --> 00:03:47,670 This amount will be used in the script. 54 00:03:47,690 --> 00:03:52,850 Now we can use it in the script to tell people about the money that the user must be. 55 00:03:53,180 --> 00:03:55,340 So here, as you can see, we have this 77. 56 00:03:55,670 --> 00:03:59,150 So instead of saying 77, we need to remove this 77. 57 00:03:59,540 --> 00:04:09,620 And instead we need to use B2B, we need to say B2B, and then we need to say echo amount, amount and 58 00:04:09,620 --> 00:04:10,550 then semicolon. 59 00:04:11,060 --> 00:04:11,630 That's it. 60 00:04:11,630 --> 00:04:12,680 Very, very simple. 61 00:04:13,250 --> 00:04:14,690 And then click on Save. 62 00:04:15,440 --> 00:04:20,990 So again, let me explain this one more time, because I think you might have gotten confused. 63 00:04:21,440 --> 00:04:27,200 So here again, if the user came from the cart, first we need to check that. 64 00:04:27,200 --> 00:04:31,910 We need to make sure that the cart is not empty and that it is not empty and it's not zero either. 65 00:04:32,750 --> 00:04:38,270 And then we at this point, we can get the total and then we can store the total in a variable called 66 00:04:38,270 --> 00:04:38,690 amount. 67 00:04:39,110 --> 00:04:42,500 And then we need to convert it to a string using the SDR function. 68 00:04:43,160 --> 00:04:51,170 And in case user came from the there they are their account because they want to pay for an order that 69 00:04:51,170 --> 00:04:52,250 they have created earlier. 70 00:04:52,820 --> 00:04:58,430 We can we should use the order total price and store it in a valuable amount. 71 00:04:58,730 --> 00:05:04,400 And by the way, here it's better also to check the to check that the order the order total price is 72 00:05:04,400 --> 00:05:14,360 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 73 00:05:14,930 --> 00:05:17,630 it's related to the order status. 74 00:05:18,140 --> 00:05:23,060 Whenever we have an order, it means we it orders that it is not paid. 75 00:05:23,390 --> 00:05:25,340 Then there is a number associated with it. 76 00:05:25,340 --> 00:05:28,070 So this is just an extra step you can add. 77 00:05:28,550 --> 00:05:29,980 But I'm not going to add it here. 78 00:05:30,410 --> 00:05:32,750 Here, I'm going to just sort of evaluating the amount. 79 00:05:33,320 --> 00:05:40,160 And then lastly here, in case, of course, the buttons will be displayed in both cases. 80 00:05:40,820 --> 00:05:42,380 Otherwise, there is no button. 81 00:05:42,380 --> 00:05:46,760 So we don't have to worry about anything if there if there is no order. 82 00:05:47,210 --> 00:05:51,560 And then in people's could we just display this amount? 83 00:05:51,980 --> 00:05:55,610 We place this amount rather than the static amount. 84 00:05:56,000 --> 00:05:59,130 Now people know about the value from us. 85 00:05:59,150 --> 00:06:05,000 Now people know that this amount is the amount of the that the customer should be pretty simple. 86 00:06:05,390 --> 00:06:12,200 And then here, upon clicking on the button, this amount will be paid by the user. 87 00:06:12,590 --> 00:06:13,640 And here on approve. 88 00:06:13,640 --> 00:06:20,510 If the amount has been approved approved successfully, then PayPal is going to return a few things 89 00:06:20,510 --> 00:06:21,860 and we can continue. 90 00:06:22,460 --> 00:06:28,460 And by the way, we can here say alert people already has a code. 91 00:06:28,460 --> 00:06:31,160 By the way, it's the other transaction. 92 00:06:31,850 --> 00:06:34,280 So we don't have to worry about this either.