Building Custom Payouts Enrollment Forms
Learn how to create fully-customized payouts enrollment forms with secure input fields
The Payment Method Form SDK provides secure input fields that you can embed into custom-built enrollment forms for collecting payout information. Unlike hosted enrollment links, the embedded form gives you complete control over your form's HTML, styling, and user experience while keeping sensitive banking data secure through isolated secure input fields.
Use the Embedded Enrollment Form when you need full design control over your enrollment experience. For a hosted enrollment page, see Enrollment Link. For direct API integration, see Back-End API.
Prerequisites
Before building enrollment forms, it's helpful to learn about the following topics.
How payment methods work
Learn how payment methods are used to store bank accounts for receiving payouts.
Enrolling accounts with entity verification
Learn how to create accounts with enhanced entity verification for payout recipients requiring business validation.
When to Use Embedded Enrollment Forms
Use the Embedded Enrollment Form SDK when you need complete control over your enrollment form's design and user experience while maintaining security. The SDK provides secure input fields that handle sensitive bank account data, isolating this data from your application while giving you full control over the surrounding UI, layout, and styling.
Common use cases
- Custom-Branded Enrollment: Build enrollment experiences that perfectly match your brand guidelines and design system
- Integrated Onboarding Flows: Embed payout enrollment directly within existing onboarding forms alongside profile information and agreements
- Multi-Step Enrollment: Create wizard-style enrollment flows with custom progress indicators and navigation
How Enrollment Forms Work
Enrollment Forms use a combination of regular HTML inputs and secure input fields:
-
Secure Input Fields: Sensitive data like account numbers and routing numbers are rendered in isolated iframes that communicate with Payload's secure environment. These fields appear as
<div>elements with special attributes. -
Regular Input Fields: Non-sensitive data like account holder name and account type use standard HTML
<input>elements with special attributes to identify them to the SDK. -
Form Submission: When the form is submitted, the SDK collects data from both secure and regular fields, sends sensitive data directly to Payload's servers, and returns a payment method ID to your application.
Security: Sensitive banking data never touches your server. The secure input fields communicate directly with Payload's secure environment, protecting your application from security and compliance risks.
Building an Enrollment Form
Creating a payouts enrollment form requires three steps: building the HTML form, creating an intent on your backend, and initializing the form with JavaScript.
This example shows the complete flow for building a custom payouts enrollment form:
- Backend: Create an intent with
type='payment_method_form'and configuretransfer_type='receive_only'for payouts - Frontend HTML: Build your form with
pl-form="payment_method"attribute and secure input fields usingpl-inputattributes - Frontend JavaScript: Initialize with
Payload(token)andnew Payload.Form(formElement), or use React components like<PaymentMethodForm>,<RoutingNumber>, and<AccountNumber> - Event Handling: Listen for
successorerrorevents (or use React props likeonSuccess,onError)
The secure input fields (pl-input="routing_number", pl-input="account_number") render as
iframes that capture sensitive data without exposing it to your application.
Secure Input Fields
The Payment Method Form SDK provides secure input components for capturing sensitive banking data. These fields are rendered as isolated iframes that communicate directly with Payload's secure environment.
Bank Account Input Fields
For payouts, use bank account input fields:
This creates input fields for routing number and account number for receiving payouts. The
transfer_type='receive_only' configuration ensures the payment method can only be used for
receiving payouts, not sending payments.
Plaid Integration
For a streamlined enrollment experience, integrate Plaid to allow recipients to connect their bank accounts by logging into their bank. Plaid reduces form friction by eliminating manual data entry.
To enable Plaid, call .plaid() on your form instance and pass a button element. When clicked,
Plaid's modal will open for the recipient to securely connect their bank account.
Streamlined Experience: Plaid allows recipients to connect their bank accounts by logging into their bank, eliminating the need to manually enter routing and account numbers.
Handling Form Events
The Payment Method Form SDK emits events throughout the enrollment lifecycle. Listen for these events to handle successful enrollments, errors, and validation.
Success Events
form.on('success', (evt) => {
console.log('Payment method created:', evt.payment_method_id)
window.location.href = `/enrollment/success?pm=${evt.payment_method_id}`
})Error Events
form.on('error', (evt) => {
console.error('Enrollment error:', evt.message)
alert(`Error: ${evt.message}`)
})Validation Events
form.on('invalid', (evt) => {
console.log('Invalid:', evt.message)
if (evt.target) evt.target.classList.add('pl-invalid')
})
form.on('valid', (evt) => {
if (evt.target) evt.target.classList.remove('pl-invalid')
})Styling Secure Input Fields
You can style secure input fields to match your form's design using several approaches. While secure inputs are rendered in isolated iframes for security, the SDK provides multiple ways to apply custom styling.
Extend Payload Classes
Style secure inputs by targeting Payload's default CSS classes:
/* Extend default Payload classes */
.pl-input {
font-family: "Your Custom Font", sans-serif;
font-size: 16px;
padding: 12px;
border: 1px solid #ddd;
border-radius: 4px;
}
.pl-input-sec {
background-color: #fff;
}
.pl-focus {
border-color: #007bff;
box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}
.pl-invalid {
border-color: #dc3545;
}Payload provides default classes that you can extend with custom CSS rules:
-
pl-input- Base input styling -
pl-input-sec- Secure field styling -
pl-focus- Focused input state -
pl-invalid- Invalid input state
Schema Reference
The following fields are available when configuring the Payment Method Form intent. For complete API reference, see Intent API Reference.
Intent Configuration
Configuration options passed when creating the payment method form intent on your backend:
payment_method_formpayment_method_templateaccount_defaultsfundingall, deposits, withdrawspayingall, payments, payoutsaccount_holderaccount_idbank_accountcurrencyUSD, CADbilling_addressaddress_line_1address_line_2citycountry_codepostal_codestate_provinceidtransfer_typesend_only, receive_only, two_wayNext Steps
Enhance your custom enrollment form implementation
Send Payouts to Enrolled Recipients
Start sending payouts to enrolled recipients using the payment method IDs returned from completed enrollment forms.
Monitor Enrollment Events
Subscribe to webhook notifications to receive real-time updates when recipients complete enrollment forms and payment methods are created.
Manage Payment Methods
Use the Payment Methods API to retrieve, update, and manage enrolled payout recipient bank accounts after form submission.
Related articles
- Enrollment Link - Hosted enrollment page alternative
- Back-End API - Direct API integration alternative
- Intents API Reference
- Payment Methods API Reference
- Accounts API Reference