PayPal Plug-in for SmartFormer Gold. Documentation
PurposePayPal 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.
LicensePayPal 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.
InstallationTo install PayPal SmartFormer Gold plug-in:
General SettingsOnce 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). Scroll down to see the settings of the plug-in. 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 FormWhen you create a new form or edit an existing one to add PayPal functionality – you will see new Snippets: They are:
Setting Up Payment ParametersLet us create a new form and add PayPal button with user details on it. Select Buy Now button. You will see the box with its properies. Apart from standard SFG button’s properties there are several new available:
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:
The following parameters also correspond to the fields of the button and have the same logic.
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 FormIf 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:
...
So you create a new hidden field.
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 PayPalThere are several ways to send the sum to PayPal. The following priority is used in PayPal SFG plug-in (lower to higher):
Payment OrderWhen your customer presses a PayPal button – he/she is redirected to the PayPal’s page. 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. 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.
|