Payment Form Models
The payment form model is a special model used to validate payment parameters and pass them on to a payment gateway in a way it expects.
When returning after a validation error, a paymentForm
variable will be available to the template and set to an instance of BasePaymentForm (opens new window).
Each gateway can use its own payment form, however it must extend BasePaymentForm (opens new window). There are generic models available for use, specifically for gateways passing around credit card information, but you should refer to the documentation of the plugin providing the gateway to see whether it uses its own model.
Generally, you shouldn’t be concerned with the specific type of payment form model being used, as it’s provided by the gateway and doesn’t need to be configured.
# Model Attributes
The following payment form model attributes exist for gateways handling credit card information:
Attribute | Validation | Description |
---|---|---|
token | not validated | If a token is found on the payment form, no validation of other fields is performed and the data is ignored. The token represents a pre-validated credit card and is provided by a gateway’s client-side JavaScript library. One example of this is Stripe.js (opens new window). |
firstName | required | The first name on the customer’s credit card. |
lastName | required | The last name of the customer’s credit card. |
month | required, min: 1 , max: 12 | Integer representing the month of credit card expiry. |
year | required, min: current year, max: current year + 12 | Integer representing the year of credit card expiry. |
CVV | minLength: 3, maxLength: 4 | Integer found on the back of the card for security. |
number | Luhn algorithm (opens new window) | The credit card number itself. |
threeDSecure | not validated | A flag indicating whether 3D Secure authentication is being performed for the transaction. |