Hi Shawn, Thank you so much for the reply. I have spent some more hours wildly trying things at random and have progressed no further. If you have time, can i ask for some more help please [example code is good, if you have it]. Can i break it down into two steps. A) The verification on the server side, the response and redirect. B) Whether i need the SDK and how to install it if i do. A) The verification on the client and server side, the response and redirect Specifically can we focus on this please - "From there, just check that the information received is what you expected, and if it is, release the product". this is where i could really use some guidance and example. For info, my buttons and the call are in a file called checkout.php. In the sample code I see within onApprove an alert and a fetch. The alert works and the fetch, I have no idea. So presumably 100/100 people want to redirect their customer to another URL after a successful payment process and 0/100 actually want to display this alert window - i.e. i guess this alert is for test purposes only. Also the alert is before the fetch anyway, so i guess that ultimately the alert gets removed? I have created a file called paypal-transaction-complete.php and uploaded it and changed my checkout.php file to say "return fetch('/paypal-transaction-complete.php', {". As you explained, the fetch should post the orderID to the php and return a response. I have put the code from part 2 of step 6 of the instructions into my paypal-transaction-complete.php file. [The code that starts with "<?php namespace Sample; require __DIR__ . '/vendor/autoload.php';.... "]. This code is clearly reliant on other includes and things, so it's not going to do anything until I have installed the SDK, right? However, interestingly, I do not see any errors when i run this. I guess that the errors and warnings are happening serverside or my path is wrong. Questions: 1) Is it the code in the example that goes into the paypal-transaction-complete.php file or is it something entirely different that i need to write. If the latter, do you have some sample code please? 2) Am i correct in thinking that i process my database work and do my redirect inside my original checkout.php file after i have got the return from the fetch OR does the paypal-transaction-complete.php do this work. I think the former as the paypal-transaction-complete is just a server side thing, right? 3) If it is my checkout.php where i do the work after the positive response from the fetch, what is the response from the fetch, a json encoded string? So, this is the "From there, just check that the information received is what you expected, and if it is, release the product" question! Where in checkout.php do i put code to check the response; what does apositive response look like; How do i redirect? header('Location: confirm.php'); or a hidden form with some post data and java submit or something i guess? This is my checkout.php page at the moment - please, where do i put what i want to process the response and redirect? <div id="shopping-cart"> <?php if(isset($_SESSION["cart_item"])){ $total_quantity = 0; $total_price = 0; ?> <table class="tbl-cart" cellpadding="10" cellspacing="1"> <tbody> <tr> Confirm Order Total Cost </tr> <?php $total_price = 0; foreach ($_SESSION["cart_item"] as $item){ $total_price += ($item["price"]*$item["quantity"]); } ?> <tr> <td>We are ready to process your order. Please acknowledge the terms and conditions and continue to payment.</td> <td align="left" colspan="1"><strong><?php echo "£ ".number_format($total_price, 2); ?></strong></td> </tr> </tbody> </table> <div id="validate_payment"><input type="checkbox" name="tandc" id="tandc" value="" onclick="validate_payment()"> I accept the terms and conditons and wish to proceed to purchase.<br></id></div> <div class="align-right"> <div id= "paypal_screen" title="Please tick terms and conditions box to proceed."><img src="images/screen.jpg"></div> <div id="paypal_button" class="align-right"> <!-- Set up a container element for the button --> <div id="paypal-button-container"></div> <!-- Include the PayPal JavaScript SDK --> <script> // Render the PayPal button into #paypal-button-container paypal.Buttons({ // Set up the transaction createOrder: function(data, actions) { return actions.order.create({ purchase_units: [{ amount: { value: '' } }] }); }, // Finalize the transaction onApprove: function(data, actions) { return actions.order.capture().then(function(details) { alert('Transaction completed by ' + details.payer.name.given_name); // Call your server to save the transaction return fetch('/paypal-transaction-complete.php', { method: 'post', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ orderID: data.orderID }) }); }); } }).render('#paypal-button-container'); </script> </div> </div> <? } else { ?> <div class="no-records">Your Cart is Empty. Sorry, you shouldn't be here, please choose from the menus.</div> <?php } ?> </div> B) Whether i need the SDK and how to install it if i do. I think i can possibly muddle through A) on a good day, but where i really need help is this area. Let's assume that i am going to install the SDK, as you say that the other alternative involves a complicated process. How anything could be more complicated that this, I cannot image; but that's my problem 🙂 So i need to install the SDK. I have tried: 1) following the instructions on this page: https://developer.paypal.com/docs/checkout/reference/server-integration/setup-sdk/# I get as far as the first step: Put simply, I don't know where i type this command. 2) following the 'Using composer' instructions on this page: https://github.com/paypal/PayPal-PHP-SDK/wiki/Installation . I can get as far as this screen after downloading composer-setup.exe: I don't have php on my PC I have it on my 1&1 webserver so i don't know how to progress. 2) following the 'Using direct downloads' instructions on the page. I get as far as 'Go to your project directory', step 2. How can i be in a position where i have a command line console on my 1&1 webserver? Or can i just create a directory in FileZilla and copy the files there? I wonder, does it have to be called 'project'. I don't really want all that stuff in my root directory with my php and css files. 3) I tried downloading putty. Completely baffling: Uncertainty about the folder structure in the SDK: There are various Zip files on various websites. I have downloaded the zip from here: http://paypal.github.io/PayPal-PHP-SDK/docs/ also from here: https://github.com/paypal/Checkout-PHP-SDK I can't help but notice that in the sample code (in paypal-transaction-complete), there are references to '/vendor/autoloader.php' and Sample\PayPalClient and PaypalCheckoutSdk\Orders... There are no such locations in the zip file directory structure that I have , so i think that this is going to fail anyway. Conclusion Well, if you are still with me then thank you again. If you do manage to help me, then i will post a step by step guide for all web novices that can do a bit of php/java/html but have no idea about APIs. So you will be helping a big group of people in the long run. Thanks again.
... View more