Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
First, set up a Basic Payment Form with a minimum payment amount by following the steps here:
In some use-cases you may wish the amount to be paid to depend on the User's input into the Form Fields e.g.
The User is making charitable donations. The minimum payment is $2, but they can choose to donate any amount above that they wish.
The User will select options on the Form that will inform a logical function to decide how much they need to pay.
Both use-cases will require you to write a JavaScript function which will update the value of the amount due.
You may find the following Liquid tags helpful while developing:
` | The currency for the Form defined in Admin | gbp | | `` | The symbol for the currency for the Form defined in Admin | £ | | `` | The `minimum payment` value defined in Admin, in the lowest denomination of that currency | 100 | | `` | The `minimum payment` value defined in Admin, formatted | 1.00 |
The end goal of such a JavaScript function will be to set the value of hidden field with the ID "s_e_amount
". The default value of this field will be the same as the minimum payment value you set in Admin, until it is changed via JavaScript. The final value should be an integer (whole number) of the number of cents that will be paid.
We'll give you an example of how this JavaScript may work here. You can adapt this example to suit your use case. The important thing is that you set the value of the field with the ID "s_e_amount
".
The following example allows the User to enter an amount of their choice into an input in the Form. Our function changes the format, then sets the value of the hidden field.
This example shows how you can add an "amount" parameter to the URL- if this parameter exists then the s_e_amount
will be updated.
The following Javascript can be added to your Basic Payment Form's Layout. The first half of the function will store the amount parameter within the "amount" variable, the second half checks if "amount" exists (this prevents "null" from getting added to s_e_amount
) if so then s_e_amount
is updated with the new price:
An example URL might be, to set the price to 20.00 or 2000 pence/cents:
You have set up a PayPal Payment Gateway, with the required authentication:
The PayPal Payment Gateway is compatible with Basic Payment Forms and Checkout Forms. However, there are a few differences to take into account when you choose this Payment Gateway.
PayPal creates its own secure Submit Buttons for the payment Form. This means you should remove the default submit button from the Form Layout if you are using the PayPal Payment Gateway. We've included an error log in the JavaScript console to remind developers of this.
As custom error functions are normally passed in as an argument on the submit button's onclick listener, we've had to provide an alternative means to attach this: a global JavaScript variable.. You can set this in a <script> tag inside your Form Layout like so:
In the Secure Zones tab, pick a Secure Zone. Access will be granted when payment is made and the Form is submitted.
Back in CMS Forms, find the ID for your newly created Form:
Use this ID in the Liquid tag when you insert the Form on the Page (or use Toolbox as a quick shortcut):
Your Payment Form is now set up and ready to accept payments using the minimum payment value you set.
If your Payment Gateway is in 'Test Mode', then you may need to enter card details specific to the testing environment.
If you are using the Stripe Payment Gateway, this step is optional.
For PayPal or Authorize.net, you will need to follow the relevant extra steps:
See SiteBuilder to install a plug and play, themed Form Layout for your payment Form:
And set your Form to use it with the layout parameter.
See the Forms Reference for creating your own Layout:
By default, the Form will charge the minimum amount, but for some use cases like donations or invoices, you may want to allow them to pay more:
To include a Basic Payment Form on the Page, use the same syntax as a :
This is used to output payment fields in a basic payment form.
You should include this inside a basic payment form layout.
This HTML input field with the ID s_e_amount can be used to modify the amount which will be paid when the Form is submitted, see:
Use Emails to send confirmation messages to customers, including a detailed breakdown of their Basic Payment Submission
You have installed eCommerce Module v1.1.4 or later. Check out to find out how you can install the latest version.
You have set up a using the Stripe Payment Gateway
You can now add details of a customer's Basic Payment Form to Workflow and Autoresponder transactional emails. Give your Client and the customer peace of mind, as well as valuable records for their safekeeping. Within the email, you can also access any fields that were submitted along with the original Form. Learn more here:
To include the details of the customer's most recent Order, include the following Liquid tag:
This can be outputted in one of two places:
Inside the body of an e.g. autoresponder or workflow
Inside a
Placing in either of these locations will allow the system to identify the last submitted Form case and, if there is one, the associated payment.
You can use an existing Layout, or create a new one in this File Structure: layouts/modules/module_14/payment/my_layout.liquid
Note
Unlike the similar Order Details Layout, Payment Details is simpler, so there are no wrapper and item files.
***Accessing Payment Details ***The layout file will have access to the this
object, which will contain details about the Payment: {{this}}
Within this object, you'll have access to the following fields:
Basic Payments are a way to take a payment when a form is submitted. They may be useful for allowing Users to pay invoices etc.
You have installed the eCommerce Module in Site Settings
You have set up a
Using PayPal as a Payment Gateway? There are additional setup instructions .
Basic Payments are a way to take a payment against a standard Form submission.
You set the currency, and the minimum payment value in Form Builder.
When submitting the form, a value is sent to our payment processor, and validated server-side to check that it's higher than the minimum payment value you have set.
Here's 3 examples of when you'd use this payment system:
If you're sending invoices to a customer, and want them to pay online, they can enter their invoice number (in a custom field) and the amount to pay. You would then check 'offline' that the value paid matches that on the invoice. In this case you'd set the minimum payment value as '0.00'.
You know the exact value you want the users to pay (for example $10.00), so you set the minimum payment value as '10.00'. This is validated server-side to make sure they cannot pay less than that.
You want to charge a variable amount based on their form selections, and know the minimum value that should be. For example, the charge might be $10.00 as standard, but then have some optional custom fields that bring the price up to $20.00. See the section below: "Changing the Price based on User Form Input".
Remember, this kind of payment is designed for use cases where the customer intends to make a charitable donation or pay an invoice that is due. It is possible for the customer to modify the JavaScript and pay less (but not less than the minimum payment value). You should only use this kind of payment either when the customer does have a genuine choice, or the Client will be reconciling invoices and chasing where the correct amount has not been paid.
You must include 3 extra fields in the Form Layout for to work.
We recommend using a Custom Error Notification with PayPal. JavaScript alert messages are sometimes covered by the secure PayPal browser window- meaning the User Experience can become impaired. We'd recommend outputting error messages directly on the Page instead or using a library like .
You can see an example which does this in our updated Article.
For a basic fixed-amount set up, set the minimum payment value to exactly what you want users filling in the Form to Pay. For charitable donations and invoice payments, set the minimum payment to something minimal like $5 which avoids you making a loss on payment gateway fees for tiny transactions. Then look to
Parameter | Type | Notes |
---|
Also see
Inside your automation email body, you'll have access to the Form object: {{form.properties}}
This contains the fields submitted with the Form. Learn more here: You'll still have access to these fields throughout the Payment Details Layouts as they will be inherited.
Liquid
Role
Example
`
amount | Integer | The amount to be charged in cents/pence (e.g. 500 = $5.00) |
currency | String | The currency to charge the user |
id | Integer | The ID of the Payment Gateway to be used. If not included, then the system will output the Payment Gateway that you most recently updated in Siteglide Admin |
Tag | Description | Example Output |
{{this.currency}} | Currency code | gbp |
{{this.currency_symbol }} | Currency symbol | £ |
{{this.amount_paid}} | Amount Paid | 100 |
{{this.amount_paid_formatted}} | Amount Paid Formatted | 1.00 |
{{this.payment_id}} | Stripe Payment ID | pi* |
Field Name | Example | Notes |
Card Number | <input id="s_e_card_num" class="required" type="text" /> |
Card Expiry | <input id="s_e_card_exp" class="required" type="text" placeholder="MM-YYYY" /> | The data format must follow that in the placeholder in our example |
Card CVV | <input id="s_e_card_cvv" class="required" type="text" /> |
amount | Integer | The amount to be charged in cents/pence (e.g. 500 = $5.00) |
currency | String | The currency to charge the user |
id | Integer | The ID of the Payment Gateway to be used. If not included, then the system will output the Payment Gateway that you most recently updated in Siteglide Admin |