Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating paypal buttons on the fly

Tags:

paypal

I have a webapp, where users sell printing services, I want to allow my users to add a pay now buttons to their pages so customers can pay for their services.

My users specify their paypal email address etc in the settings and set up their services with a price etc.

What API should I use to create the pay now buttons on the fly ?

Thanks

like image 350
Jo Erlang Avatar asked May 11 '12 08:05

Jo Erlang


2 Answers

You don't need an API for creating "pay now" buttons. You can either create the button from within your customer's Paypal accounts or dynamically generate with HTML (see HTML Variables for Paypal Payments standard).

One advantage of creating the buttons from your/their Paypal account is that you can get an additional layer of security (support for encrypting the form or using a hosted button id so user cannot change the amount submitted to Paypal).

However, if you deal with hundreds of different buttons then it makes more sense to dynamically generate the buttons and just perform additional validation when Paypal sends back the confirmation (either through PDT or IPN) before shipping your items.

like image 133
pm_labs Avatar answered Sep 19 '22 17:09

pm_labs


You could use PayPal's JavaScriptButtons API and create your buttons dynamically with:

paypal.button.create(business, data, config, parentNode)
like image 30
PHearst Avatar answered Sep 18 '22 17:09

PHearst