What are Payment Views?
With E-Commerce enabled in your app and payment processors added, the final step is to add a payment view, which is a type of payment view. The payment view includes options for calculating the total payment, displaying the payment summary, sending email receipts, and rules for updating other database records.
Manage Payment Views
Add Payment Views
In order to be able to insert a payment view in your app, you must include a numeric field in your object. A numeric field is required to determine the amount that will be charged. Numeric fields include any field that can be selected from the ‘Number’ menu:
When editing a page that deals with a specific record, such as an edit form or details view, you will have the option to add a "Payment" view under the “E-Commerce” view dropdown:
Knack Tip: Not seeing the Payments dropdown? The page might not be working with an object that contains a numeric field.
Edit Payment Views
To access the payment view settings, access the "Settings" option from its dropdown menu options:
Delete Payment Views
You can delete a payment view by clicking its "delete" option in the dropdown menu. Deleting a payment view will also remove the redirect submit rule in its parent form, if present.
Payment View Settings
The payment view has a lot of unique features that are not available anywhere else, this includes additional settings, separate Payment Summary / Details sections, Email Receipts and Payment Rules.
Settings control things like the Total Payment field, your payment processors and toggle test mode. Below is a full list of all settings available.
This section displays what your current payment view is doing and allows you to go through the setup wizard again, if you need to change any settings.
When you have users enabled, from here you can choose if you want to charge a payment using a user’s stored payment method or ask for a new payment method.
Each payment view can use its own payment processor. You can add one of each processor, giving your users the ability to choose a processor prior to checkout.
Payment total Field
The Total Payment field sets the payment amount to be submitted to the payment processor. Only one amount field can be selected, but you can use complex formulas to calculate multiple values into one total.
Payment Description Field
Set the field you’d like to use to describe the payment being charged. Only one field can be selected, but you can use text formulas to combine multiple text fields into one description field.
Every Payment Processor can be used in Test Mode. Credit Cards will NOT be charged in Test Mode. Since E-Commerce is only available on Pro plans and above, Starter plans will always have Test Mode enabled.
You can learn more about Stripe test mode here.
You can learn more about Paypal test mode here.
The Total Payment field can be set to any currency. This will be the currency used when the payment is submitted to your payment processor. Knack does not convert the currency, it will use the exact value present in the payment field and charge it in the currency set here.
Submit Payment Button Text
Here you can set the text of the button that submits payment to your selected Payment Processor, on the actual checkout page.
The payment summary lets you configure and display multiple fields that contribute to the payment total. It always displays the payment total field by default; additional numeric fields (like shipping, handling, etc.) can be added by clicking on the ‘+’ icon:
This summary will also be displayed in the payment details section and it can also be used in your payment view’s email rules.
If you include any fields that may be blank on viewing this page, you can choose to hide empty fields by checking the box below your chosen fields.
Similar to a details view, the payment details page will display record details above the summary prior to submitting a payment . This can be useful to present the full details to the user so they can confirm what they are paying for. Keep in mind that the summary fields (see above) will display below any details fields you add here.
You can start dragging your own, or click the Add Fields button to pre-populate with the first 5 fields:
Here’s a preview of a live payment view with a payment details layout:
Control any emails to be sent after a successful payment. Note that both Paypal and Stripe already send out automated receipt emails, so any emails added here would be in addition to that one.
Knack Tip: You can learn more about emailing your users here.
Payment rules work exactly like record rules in a form view.
Submit rules will control what happens after the user submits a payment. It will show a "success" message by default but you can add your own rules to redirect to other pages of the app, for example.
Record Rules can update the record attached to the payment or update / insert records connected to it. These rules will only trigger for successful payments.
Common examples of payment rules include updating an invoice status to ‘Paid’, or approving a User’s account after paid registration.
To add a payment rule, click on the "Add Rule" button in either “Submit Rules” or “Record Rules” tab, then set your criteria:
Knack Tip: You can learn more about using form rules here.
Using the Payment View in your App
Once the user submits the payment form, a new Payment record will be created and automatically connected to the record from the original parent form.
If a payment is successful, your user will be redirected to the completion page. At this time any emails and payment rules you defined in the checkout view will trigger immediately.
When a payment error occurs, a new payment record connected to the form record will be created with a Failed status. A failed payment will not trigger any email / payment rules in the payment view.
The user will be alerted that an error occurred, and will be able to fill out the form again and try submitting a successful payment:
More specific details about the error will be added to the Notes field of the payment record: