This article provides insights into the Payments table and its functionality when working with E-commerce and managing payment records.
What is the Payments table?
When you activate E-Commerce, a special "Payments" table is added to your Knack app:
The Payments table includes unique fields designed to store comprehensive information about each payment. Whenever a user submits a payment through the live application, the system automatically creates a new record in the Payments table to store the details.
Tip: You can learn more about using E-commerce with your app here.
Managing the Payments Table
Fields
The Payments table contains special fields for storing specific information about each payment.
Each Payments table will include the following fields:
Charge
-
Field Type: Text Formula
-
Description: Joins the Status, Amount, and Date fields. This is the display field for the Payment record.
Amount
-
Field Type: Currency
-
Description: The total payment amount in a currency format.
Date
-
Field Type: Date/Time
-
Description: Exact time of transaction.
Status
-
Field Type: Multiple Choice
-
Description: Status of the processor transaction.
-
Complete - The payment processor has successfully charged the user for the total amount.
-
Failed - The payment processor was not able to complete the transaction. More details will be found in the Notes field.
-
Pending - A PayPal payment has been initiated but has not yet been completed. The status will update once the user takes further action.
-
Source
-
Field Type: Short Text
-
Description: The name of the view that created the Payment record.
Processor
-
Field Type: Short Text
-
Description: The payment processor used to create the Payment record.
ID
-
Field Type: Short Text
-
Description: The payment ID is automatically generated by the payment processor and can be utilized to track the specific payment with the processor.
IP Address
-
Field Type: Short Text
-
Description: The IP Address of the user when the Payment record was created.
Description
-
Field Type: Short Text
-
Description: Provides details about a transaction.
Notes
-
Field Type: Short Text
-
Description: Provides details about a failed transaction.
Account
-
Field Type: Connection
-
Description: The user record that was charged the payment, if available.
Payments Records
When a user submits their payment information from a payment view, a payment record is automatically generated in the Payments table to store the details of the payment. To view Payment records, simply click on the Records list next to the Fields list or select the "Records" tab on the left side navigation.
A Payment record is generated every time a payment view is submitted, regardless of the success of the payment. This feature enables you to keep track of both failed and pending payments, as they are stored in the Status field.
Connections
Payment records will always be connected to the record that initiated the payment view.
The first time you enable E-Commerce for a table, a "Payment" connection field will be created in that table:
One-to-One Connections
By default, the payment connections are set up as one-to-one connection types. This ensures that each form submission will be linked to a single payment record.
When a one-to-one connection is set up, any new payments made on a record will overwrite the existing connected payment.
Many-to-One Connections
If you require the ability to accept multiple payments for a single record, such as splitting payments for a large invoice, you have the option to modify this connection field to a many-to-one connection. This will allow you to connect multiple payments to the same record.
With a many-to-one connection, any new payments will be added to any existing connected payments. This way, multiple payments can be connected to the record.
Tip: You can learn more about working with connections here.
Notes & Troubleshooting
Limitation
When using Stripe, "Customer" information under your Stripe login will only come through if a Live App user has used a saved Payment Method. If you need the customer name to come through for every transaction, whether they've used a stored payment method or not, you'll want to use a Text Formula field to combine multiple text fields needed into one description field.
Record Creation
A payment record can only be created through a payment view submission. You can not create payment records through the Knack builder.
Form Rules
Payment records are not accessible in any type of Form Rule (Submit, Display, or Record rules).