Use PHP to hide the amount - Pinpayments ← (PHP)

So, Pinpayments (which is a payment gateway) have a really really simple integration which is show below:

<script src="https://cdn.pinpayments.com/pin.v2.js"></script> 
<a class="pin-payment-button" href="https://pay.pinpayments.com/rc3g/test?amount=13"><img src="https://pinpayments.com/pay-button.png" alt="Pay Now" width="86" height="38"></a>

What I'm struggling to do is pass the "amount" via PHP so it's not hardcoded in to the link, users could easily just change this value via inspect.

How do I do this with PHP?

Answer



Solution:

You can't really.

While you could store the value in, for example, a session and then use a 302 redirect to send the user's browser there, that would only be very slightly harder to change. You still need to give the value to the user and let them go to the payment service.

The proper way to solve this is to check that the amount you receive is correct before giving the user whatever it is they are paying for.

Source