Contact form with payment gate?

I’m not a PHP expert, but I think you could create a PHP thank you page and then add some code to it similar to the following
<?php

  //This function returns True if query string contains 
  secretkey and secretvalue. 
  //Otherwise it returns False 

  function CheckAccess()   
  { 
    return @$_GET['secretkey']=='secretvalue';   
  } 
  
  ?>  

Then, in your URL link you provide to PayPal you would add the secret key such as:

http://www.yoursite.com/thankyou.php?secretkey=secretvalue

Hopefully, one of our PHP gurus will come along and tell us if this solution would work.

Maybe run it past @PeteSharp

I just tested this and although I am no PHP guy, this works:

<?php
$allowed = $_GET['id'];
if ($allowed == 'QwXc5d') {
	echo 'Content displayed';
}
else 
	{
echo 'Sorry you are NOT authorised';
} 
?>

This means sending them to a thanks url will show whichever text you want. Here is a live example:

https://dacsecure.com/a/thankyou.php?id=QwXc5d - AUTHORISED
https://dacsecure.com/a/thankyou.php?id=wrongpassphrase - NOT AUTHORISED

@Hypnoman Thanks for that - Should be good for what @Stewie_Griffin needs. It’s not foolproof as someone that had legitimate access to the URL could copy it and send it to someone else, but hey, we can’t assume everyone’s out to get us.!!!

Thanks a lot guys! So I need to turn my site into php or should I live it on html?

only the thankyou page needs to be a PHP page.

what would happen if they copy the address? https://dacsecure.com/a/thankyou.php?id=QwXc5d It needs to be a code that some how access them to enter once!

The easiest way would probably to have a .htaccess rule on your web server that hides the extension in the URL (the bit from the ? onwards). Because I’m not a PHP person, I’ll have to leave it for someone else to give you the code. All you need to remember is that the code goes into the .htaccess file on your server and not in your blocs web page. Good Luck

Hey so Im having a problem cause once you do the paypal payment it doesn’t redirect you to the thank you page. Im getting a popup from paypal on the page and when you pay it it keep you on the same page! Any idea who to fix it?

Have you routed your donation button back to the thank you page:

Im using the check out button and its redirected!

I think you have to ask PayPal what the issue is. If they tell you, be sure to let us know - it may help others that have a similar problem,

1 Like

Do you have the redirect url - is it the same as what is in Paypal - just checking.

yes the same!

Does it look like this:

And do you have auto-return enabled:

Log in to your Account
Select “Edit Profile”
Under “Selling Preferences”
Select “Website Payment Preferences”
Note first option - Select “On” - Auto Return for Website Payments
Enter the Return URL.
Click “Save.”

Just send them an email! Lets see what they said!

Here its the code I used with my id:

                                    <div id="paypal-button-container"></div>
                                    <!-- Add the checkout buttons, set up the order and approve the order -->
                                    <script>
                                        paypal
                                            .Buttons({
                                                style: { shape: "rect", color: "silver", layout: "vertical", label: "paypal" },
                                                createOrder: function (data, actions) {
                                                    return actions.order.create({ purchase_units: [{ amount: { value: "1" } }] });
                                                },
                                                onApprove: function (data, actions) {
                                                    return actions.order.capture().then(function (details) {
                                                        alert("Transaction completed by " + details.payer.name.given_name);
                                                    });
                                                },
                                            })
                                            .render("#paypal-button-container"); // Display payment options on your web page
                                    </script>

And at paypal they told me I have to add this code to make a redirect call.

Any idea where to add it on my code?

// Make a call to the REST API to set up the payment

    return actions.payment.create({
      payment: {
        transactions: [
          {
            amount: { total: '0.01', currency: 'USD' }
          }
        ],
        redirect_urls: {
          return_url: 'https://example.com',
          cancel_url: 'https://example.com'
        }
      }
    });

by the way do you know how to make the donation button a bit more custom? something like this because they orange button its a bit ugly and unstylish right?

I don’t think you can change the colours or logos in the buttons, but you can add some additional text such as the “Pay With” text added to the buttons below. You will find the option to do this when you create your buttons in your PayPal account. You could check out the HTML variables options to see if that has options for changing colours - I’ve never looked in there, so it may be worth taking a peek.

Im keen to see the finished result of this :wink:

haha! at the end I used the donation button! because I tried with the checkout code but it didn’t work how I wanted. Yes @hendon52 you can change the colours, I made mine on silver, you just need to add the code, the problem was the redirect code wasn’t working for me as this particular checkout brings up a popup box. Contacted someone on fiverr and they told me its wasn’t possible to do redirect with this… but I think we know more about code and everything here than the whole fiverr together looooool. So I the end I just used the donation button as @Hypnoman described but I design the button with blocs

You have the option of redirecting to your page after payment and in this way PayPal bring you to their site. You can also apply the same for a normal buy now button using their link.

1 Like