hrsetyono
hrsetyono

Reputation: 4464

Paypal - Dynamically change HTML variable for "Buy Now" button?

I'm new to Paypal integration. I need to dynamically change the HTML variable to the Buy Now button since I need to calculate discount_rate and shipping.

At first I use the hosted button, but then realized that I can't add new variables.

So I found this alternative way which is creating our own button. But then the customer can simply "Inspect Element" and change the value of the input.

Is there better and more secure way to implement dynamic pricing for Paypal?

Can I submit the payment through backend script like PHP?

Thanks

Upvotes: 2

Views: 789

Answers (1)

sousdev
sousdev

Reputation: 142

You can use the PayPal express checkout API to create a purchase in the background then send the user to PayPal with a token linked to this purchase. if you do go down this route, I recommend using this class as it is very simple, yet powerful; https://github.com/thenbrent/paypal-digital-goods/

On the other hand you can continue what you are doing with the non-hosted buttons and simply check the gross amount paid by the user against what they should have paid in your notify script.

Upvotes: 2

Related Questions