Username
Password
Remember Me
Log in
PayPal Plug-in for SmartFormer Gold. Documentation

Purpose

PayPal Plug-in for SmartFormer Gold is a good way to easily add PayPal functionality to your SFG forms. It adds new snippets with ready PayPal buttons – you can add either simple Buy or Doname buttons or a Button with the box that displays the quantity of products or even a Buy button with special fields for user details with one drag to your form.


The plug-in allows setting a return URL – user will be navigated to the following page of the form or to a special page selected.


With this plug-in you can manage the amount of payment – whether it is a fixed amount or a sum is calculated on the form and depends on users’ selection.

 

License

PayPal Plug-in for SFG is provided under GPL license, once bought it can be installed on the unlimited number of domains. The license includes free life-time updates.

 

Installation

To install PayPal SmartFormer Gold plug-in:

  • Download plug-in and save it locally.
  • Login to your website’s admin area. Select Components –> SmartFormer Gold -> SFG Plugin Manager.

paypal_plugin_installation


  • Install plug-in package via upload plug-in.
  • You will see it in the list of plug-ins once it is installed.

 

General Settings

Once installed PayPal SFG plug-in is integrated into your SmartFormer Gold adding new parameters, snippets and settings to it.


PayPal SFG plug-in requires general, defaults settings. You can update settings for each payment button separately, yet initial settings should be added first of all.


Select Components->SmartFormer Gold->Form Manager. Press Settings button (top right).

image2


Scroll down to see the settings of the plug-in.

image3


These settings are defaults. Enter the business account’s email to bind your website with your PayPal account. Select the currency code you will use more often (you will be able to override the currency in each form).

You can also enter a Return URL if you want your users to be redirected to a page after the payment is done. YET if you want your users to be redirected back to the form – leave this field blank.

 

Adding PayPal Buttons to your Form

When you create a new form or edit an existing one to add PayPal functionality – you will see new Snippets:

image4


They are:

  • Simple PayPal button – with this snippet you can add a button clicking which user will be directed to PayPal. The button will have a fixed payment amount (you will set it in the button’s properties).
  • PayPal button with quantity – the box will display the quantity of items to be purchased, the final sum will be sent by the Buy button.
  • Donate button – PayPal doname button
  • PayPal button with user details – user payment details will be collected and sent together with the amount.

 

Setting Up Payment Parameters

Let us create a new form and add PayPal button with user details on it.

image5


Select Buy Now button. You will see the box with its properies. Apart from standard SFG button’s properties there are several new available:

  • After submit:
    • Pay by PayPal (standart PayPal payment. Its details will depend on the parameters set)
    • Donate by PayPal (standart PayPal donation. Its details will depend on the parameters set)
    • Add to PayPal cart (if your PayPal account is set to have inner shopping cart – use this option).
  • paypal-params configuration field. It contains parameters to be sent to PayPal. Parameters will depend on the type of PayPal button you use. There are default parameters, yet you can change them.

N.B. This field has a strict format, it is VERY IMPORTANT to keep to it. All variables and values should be screened by double-quotes (”xxx”). Variables and values are separated by colons. All variables are separated by commas. The expression goes in braces.

The default parameters for PayPal button with user details are the following:

{"amount":"10", "first_name":"%field_first_name", "last_name":"%field_last_name", "address1":"%field_address1", "city":"%field_city", "state":"%field_state", "zip":"%field_zip", "country":"%field_country", "address_override":"1"}

Where:

  • "amount":"10" – means that when a user presses Buy button – he/she will pay 10 conventional units. If the currency set is USD – user will pay 10 USD.
  • "first_name":"%field_first_name" – each field in SmartFormer Gold should have a name. When we add PayPal button with user details to our form, the fields there have names already. field_first_name is the name of our First Name input box. When you put % before the name – this is treated as being SFG field. If you do not add the symbol – the parameter will be sent as text.

The following parameters also correspond to the fields of the button and have the same logic.

  • "address_override":"1" means that the address in the payer’s PayPal account will be overridden with the address the payer will enter in the field.

Some parameters are pulled from defaults settings. If you need special parameters you can add them in the button’s properties as well (so that the defaults parameters are overridden).


E.g.

If your default currency is EUR, yet you need this particular form to have USD – you can add the following to the parameters’ line: “currency_code”: “EUR”

If you have a defaults return URL, yet this form should have another one – add the following to the parameters: “return”: “//www.itoris.com”


More information about parameters is available in PayPal’s official documentation


PayPal buttons can be – Button Type 1, Button Type 2, images, links.

 

If You Need to Calculate the Final Sum on the Form

If there are several conditions on your form that influence the final amount to be paid, or there are several products to be bought – you will need to calculate the final price and send it to PayPal. Here you cannot set a fixed amount in the button’s properties.


The final amount can be send to PayPal using JS:

  • Open HTML Editor
  • Before the tag add the following:
...

So you create a new hidden field.

  • Add the results of calculation to this field. E.g.
document.getElementById('sfg_force_paypal_params').value='{"amount": "55.06"}';

Another way to sent the final amount calculated is to use PHP. To do it use the global variable E.g.

$GLOBALS["sfg_force_paypal_params"] = '{"amount": "55.06"}';

 

Priority of Parameters Sent to PayPal

There are several ways to send the sum to PayPal. The following priority is used in PayPal SFG plug-in (lower to higher):

  • Amount taken from the defaults settings
  • Amount taken from the properties of Buy button
  • Amount taken from the hidden field (JS)
  • Amount taken from the global variable (PHP)

 

Payment Order

When your customer presses a PayPal button – he/she is redirected to the PayPal’s page.

image2


After the payment data is entered PayPal will offer the customer to return back. If you have not entered a URL in Return URL field in settings, neither have you added return parameter to JSON field in the button’s properties – the customer will be redirected to the following page of the form. I.e. if you have a PayPal button on the second page, the customer will be redirected to the third page. You can create a Thank You page as the following page – or set redirect URL to direct your customers to a website’s page.

image3


One more great advantage of the plug-in – you can save the submission of the form to DB and send email notification to administrator BEFORE your customer is redirected to PayPal.


Moreover, you can return your customer back to the form after the successful payment.