Personalize PayPal parameters per form
You can control the PayPal transaction parameters through custom scripting. This will allow you to configure the PayPal data for each form separately. In this example we will change the following details:
- the language of the PayPal page
- the return URL
First we will need to set the default data that will be used by the PayPal plugin. This is done from Components > RSForm!Pro > Configuration > PayPal. This information will be used for all your payment forms, unless overwritten through custom scripting.
After this is done we will need to add the actual script that will overwrite the default configuration in our form. The script will need to be added in the Scripts called after form has been processed from the PHP Scripts tab.
// Get a new instance of the PayPal object. $paypal = RSFormProPayPal::getInstance(); // Next we will change the language used on the PayPal page using the `lc` parameter $paypal->args['lc'] = 'your_desired_language_code'; // Lastly we will change the return URL through the `return` parameter $paypal->args['return'] = 'your_desired_return_URL';
Aside from the 3 parameters listed above you can also change:
- the product(s) name - item_name
- the currency used in the transaction - currency_codeNote:
Although the currency will be changed, the transaction amount/price will not be converted to the new currency. - the transaction cost - amount
- the notify URL(this is used to receive the payment confirmation from the PayPal gateway) - notify_url
- the cancel URL - cancel_return
- the tax applied to the transaction - tax (for the fixed value tax ) and tax_rate (for the percentage tax)
You can view the official PayPal documentation for a complete list of accepted parameters.
19 persons found this article helpful.