Bill
Paying Invoices
Invoice Payment Requests

Invoice Payment Requests

Send secure payment links to customers for easy invoice payment collection


Invoice payment requests provide a simple way to collect invoice payments through secure, hosted payment pages. By generating a payment request link for an invoice, you can give customers an easy way to pay without building custom checkout UI. Share links via email, SMS, or any communication channel—customers complete payment on a Payload-hosted page and the invoice is automatically updated when payment is received.

Prerequisites

Before creating invoice payment requests, ensure you have:


When to Use Payment Requests


Use invoice payment requests when you want to provide customers with a simple, secure way to pay invoices without building custom checkout UI.

Benefits of payment requests

  • No Custom Checkout: Skip building payment forms—use Payload-hosted pages
  • PCI Compliance: Secure payment collection handled automatically
  • Multiple Delivery Options: Send via email, SMS, or share URLs directly
  • Mobile Optimized: Payment pages work seamlessly on all devices
  • Payment Method Flexibility: Support cards, bank accounts, and digital wallets
  • One-Click Sharing: Generate and share payment links instantly

Common use cases

  • Invoice Payments: Send payment links when invoices are issued
  • Payment Reminders: Share links in reminder emails for overdue invoices
  • Customer Support: Generate payment links during support calls
  • Partial Payments: Send links for installment or partial invoice payments
  • Manual Billing: Create ad-hoc payment links for custom billing scenarios
  • Account Receivables: Streamline collection workflow with shareable links

Creating Payment Requests


Create payment links for existing invoices or generate invoices and payment links together.

Reference an existing invoice by ID to create a payment link.

import payload
pl = payload.Session('secret_key_3bW9...', api_version='v2')
 
# Create a payment request link for an invoice
payment_link = pl.PaymentLink.create(
    type='one_time',
    invoice_id='inv_abc123'
    # amount, payer, and biller are inherited from invoice
)
 
print(f'Payment request created: {payment_link.id}')
print(f'Payment URL: {payment_link.url}')
print('Share this URL with the customer to collect payment')
 
# The link expires after 60 days or when payment is completed
print(f'Status: {payment_link.status}')

When to use:

  • Invoice already exists in your system
  • Sending payment requests after invoice generation
  • Creating payment links for existing balances

Benefits:

  • Simplest approach for existing invoices
  • No need to specify amount or payer details
  • Automatically uses current invoice balance

Create a payment link with an inline invoice in a single API call.

import payload
pl = payload.Session('secret_key_3bW9...', api_version='v2')
 
# Create a payment link with an inline invoice
payment_link = pl.PaymentLink.create(
    type='one_time',
    invoice={
        'due_date': '2024-03-01',
        'description': 'Consulting services - February 2024',
        'payer': {
            'account_id': 'acct_customer123'
        },
        'biller': {
            'account_id': 'acct_merchant456'
        },
        'items': [
            {
                'type': 'line_item',
                'description': 'Professional consulting (hourly)',
                'line_item': {
                    'value': 175.00,
                    'qty': 8
                }
            },
            {
                'type': 'line_item',
                'description': 'Project materials',
                'line_item': {
                    'value': 250.00,
                    'qty': 1
                }
            }
        ]
    }
)
 
print(f'Payment link created: {payment_link.id}')
print(f'Invoice created: {payment_link.invoice_id}')
print(f'Payment URL: {payment_link.url}')
print('Share this URL with the customer to collect payment')

When to use:

  • Creating invoice and payment link together
  • Immediate payment link generation needed
  • Streamlined checkout flow

Benefits:

  • Single API call creates both invoice and link
  • Invoice automatically linked to payment link
  • Faster workflow for new invoices

Payment link details:

  • Links expire after 60 days or when payment is completed
  • Amount is set to the invoice's current balance_due
  • Payer and biller information inherited from invoice
  • Payment automatically allocated to the invoice
  • Invoice status updates automatically on payment completion

Sending Payment Requests via Email


Automatically send payment request links to customers via email.

import payload
 
pl = payload.Session('secret_key_3bW9...', api_version='v2')
 
# Create and automatically send a payment request via email
 
invoice = pl.Invoice.select(pl.Invoice, pl.Invoice.payer.account).get('inv_abc123')
 
# Create payment link - email is automatically sent to the payer from the invoice
payment_link = pl.PaymentLink.create(
    type='one_time',
    invoice_id=invoice.id,
    description='Payment request for Invoice #1234',
    # Payer info (including email) is derived from the invoice
    # To prevent automatic email, add: email_customer=False
)
 
print(f'Payment request created and sent: {payment_link.id}')
print(f'Email sent to: {invoice.payer.account.contact_details.email}')
print(f'Payment URL: {payment_link.url}')
print(f'Status: {payment_link.status}')  # Will show 'sent' after email is delivered
 
# Customer will receive an email with the payment link

Email delivery behavior:

  • Email is automatically sent to the payer from the invoice (payer info is derived)
  • Payload sends a professional email with the payment link
  • Email includes invoice details and payment instructions
  • Link status changes to sent after email delivery
  • Customer receives a "Click here to pay" button in the email
  • To prevent automatic email sending, set email_customer: false

Email content includes:

  • Subject line with invoice reference
  • Payment amount and due date
  • Business/merchant information
  • Secure payment link button
  • Invoice details and line items

Tracking email delivery:

# Check if email was delivered
payment_link = pl.PaymentLink.get("pay_xyz789")
 
print("Link status:", payment_link.status)

Sending Payment Requests via SMS


Send payment request links directly to customers' mobile phones via SMS.

SMS delivery

Include customer phone number to trigger SMS sending:

payment_link = pl.PaymentLink.create(
    type="one_time",
    invoice_id="inv_abc123",
    description="Invoice #1234 Payment"
)
 
print("Short URL:", payment_link.url)

SMS delivery behavior:

  • Include notifications array with phone to trigger SMS
  • Phone number must be in E.164 format (e.g., +15555551234)
  • Message includes shortened payment link
  • Customer receives text with tap-to-pay link
  • Optimized for mobile device payment experience

SMS message format:

[Business Name]: You have an invoice for $149.00.
Pay securely here: https://pay.link/xyz123

Customizing Checkout Options


Configure which payment methods and features are available during checkout.

import payload
pl = payload.Session('secret_key_3bW9...', api_version='v2')
 
# Create a payment request with custom checkout options
 
invoice = pl.Invoice.get('inv_abc123')
 
payment_link = pl.PaymentLink.create(
    type='one_time',
    invoice_id=invoice.id,
    description='Pay Invoice #1234',
    checkout_options={
        'card_payments': True,           # Enable card payments
        'bank_account_payments': True,   # Enable bank account payments
        'enable_mobile_wallets': True,   # Enable Apple Pay / Google Pay
        'enable_plaid': True,            # Enable Plaid bank verification
        'billing_address': True,         # Collect billing address
        'auto_billing_toggle': True      # Show autopay opt-in checkbox
    },
    field_options={
        'payer_fields': 'required',      # Require customer information
        'custom_fields': [
            {
                'section': 'Additional Information',
                'fields': [
                    {
                        'name': 'purchase_order',
                        'title': 'Purchase Order Number',
                        'type': 'text',
                        'optional': False
                    },
                    {
                        'name': 'notes',
                        'title': 'Payment Notes',
                        'type': 'textarea',
                        'optional': True
                    }
                ]
            }
        ]
    }
)
 
print(f'Payment request created: {payment_link.id}')
print(f'Payment URL: {payment_link.url}')
print('Checkout configured with custom options')

Checkout configuration options:

Payment Methods

Control which payment types customers can use:

checkout_options: {
    card_payments: true,           // Enable credit/debit cards
    bank_account_payments: true,   // Enable bank transfer bank accounts
    enable_mobile_wallets: true,   // Enable Apple Pay / Google Pay
    enable_plaid: true             // Enable Plaid bank linking
}

Payment method availability:

  • card_payments - Credit and debit card processing
  • bank_account_payments - bank transfer direct debit from bank accounts
  • enable_mobile_wallets - Apple Pay, Google Pay for supported devices
  • enable_plaid - Instant bank verification via Plaid integration

Field Options

Configure customer information collection:

field_options: {
    payer_fields: "required",      // Require customer name/email/phone
    // Options: "required", "optional", "disabled"
}

Payer field options:

  • required - Customer must provide name, email, and phone
  • optional - Fields shown but not required
  • disabled - Fields hidden (use for known customers)

Additional Settings

checkout_options: {
    billing_address: true,         // Collect billing address
    auto_billing_toggle: true,     // Show autopay enrollment checkbox
    payment_method_preview: true,  // Show payment method review step
    show_disclosure: true          // Display payment terms
}

Additional checkout features:

  • billing_address - Require full billing address for AVS verification
  • auto_billing_toggle - Let customers opt into automatic payments
  • payment_method_preview - Show confirmation step before payment
  • show_disclosure - Display legal terms and processing disclosures

Collecting Custom Information


Add custom fields to collect additional information during payment.

Custom Field Configuration

field_options: {
  custom_fields: [
    {
      section: "Order Information",
      fields: [
        {
          name: "purchase_order",
          title: "PO Number",
          type: "text",
          optional: false,
          placeholder: "Enter your PO number"
        },
        {
          name: "department",
          title: "Department",
          type: "text",
          optional: true
        }
      ]
    },
    {
      section: "Delivery Instructions",
      fields: [
        {
          name: "delivery_notes",
          title: "Special Instructions",
          type: "textarea",
          optional: true,
          placeholder: "Any special delivery instructions..."
        }
      ]
    }
  ];
}

Custom field types:

  • text - Single-line text input
  • textarea - Multi-line text area
  • email - Email address with validation
  • phone - Phone number input
  • date - Date picker
  • checkbox - Boolean checkbox
  • select - Dropdown menu

Field properties:

  • name - Field identifier (used in transaction attrs)
  • title - Label displayed to customer
  • type - Field input type
  • optional - Whether field is required (default: false)
  • placeholder - Hint text shown in empty field
  • value - Pre-filled default value
  • readonly - Display-only field (cannot be edited)

Accessing Custom Field Data

After payment is completed, custom field values are stored in the transaction attrs:

transaction = pl.Transaction.get("txn_abc123")
 
print("Custom field values:", transaction.attrs)
# {
#   "purchase_order": "PO-2024-001",
#   "department": "Accounting",
#   "delivery_notes": "Deliver to back entrance"
# }

Handling Payment Completion


Process and verify payments after customers complete payment requests.

Webhook Notifications

Configure webhooks to receive reliable payment notifications:

# Webhook handler for payment completion
from flask import Flask, request
 
app = Flask(__name__)
 
@app.route("/webhooks/payload", methods=["POST"])
def handle_webhook():
    event = request.json
 
    if event["trigger"] == "processed" and event["triggered_on"]["type"] == "payment":
        transaction_id = event["triggered_on"]["id"]
 
        transaction = pl.Transaction.get(transaction_id)
 
        if transaction.invoice_allocations and len(transaction.invoice_allocations) > 0:
            invoice_id = transaction.invoice_allocations[0]["invoice_id"]
 
            invoice = pl.Invoice.get(invoice_id)
 
            print("Invoice payment received!")
            print("Transaction:", transaction.id)
            print("Invoice:", invoice.id)
            print("Invoice status:", invoice.status)
            print("Remaining balance:", invoice.totals["balance_due"])
 
    return "OK", 200

Webhook setup:

  1. Create a webhook with trigger: 'processed'
  2. Set reference_object: 'transaction'
  3. Point to your webhook handler URL
  4. Process payment events in real-time

Managing Payment Request Links


Update, cancel, or resend payment request links.

Resend Payment Requests

# Resend an existing payment link via email
def resend_payment_request(link_id, email):
    link = pl.PaymentLink.get(link_id)
 
    if link.status == "completed":
        print("Payment already completed")
        return
 
    if link.status == "expired":
        print("Link expired - create a new one")
        new_link = pl.PaymentLink.create(
            type="one_time",
            invoice_id=link.invoice_id
        )
        print("New payment link sent:", new_link.url)
        return
 
    pl.Notification.create(
        payment_link_id=link.id,
        email=email
    )
 
    print("Payment reminder email sent to:", email)

Cancel Payment Links

# Delete a payment link to prevent use
link = pl.PaymentLink.get("pay_xyz789")
link.delete()
 
print("Payment link canceled and cannot be used")
 
# Or update to inactive status
deactivated = pl.PaymentLink.get("pay_xyz789")
deactivated.update(
    status="inactive"
)
 
print("Payment link deactivated")

When to cancel links:

  • Invoice was paid through another method
  • Customer requested cancellation
  • Invoice was voided or canceled
  • Link was sent to wrong email address
  • Creating a replacement link with different settings

Handle Expired Links

# Find expired payment links
expired_links = pl.PaymentLink.filter_by(
    q='status == "expired" && invoice_id != null'
).all()
 
print(f"Found {len(expired_links)} expired payment links")
 
# Create new links for unpaid invoices
for link in expired_links:
    invoice = pl.Invoice.get(link.invoice_id)
 
    if invoice.status in ("unpaid", "partially_paid"):
        new_link = pl.PaymentLink.create(
            type="one_time",
            invoice_id=invoice.id
        )
 
        print(f"New link created for invoice {invoice.id}:", new_link.url)

Schema Reference


Fields relevant to invoice payment requests:

Payment Link Configuration

type
enum[string]
The intended usage pattern for this payment link. Set to "one_time" for links that should be used once and expire after 60 days, or "reusable" for links that can be used multiple times and remain valid for a much longer period.
Values: one_time, reusable
invoice_id ID of Invoice
string
The unique identifier of the invoice that this payment link is for. When an invoice_id is provided, the payment link amount, payer, and biller are automatically synchronized with the invoice and cannot be changed independently. The link will collect payment for the outstanding invoice balance. If not provided, this is a standalone payment link not tied to any invoice. (ID prefix: inv)
Pattern: ^inv_[A-Za-z0-9]+$
description
string
A human-readable description of what this payment is for. This text is displayed to the customer on the payment page and helps them understand what they are paying for. Use clear, descriptive text like "Invoice #1234 Payment" or "Monthly Subscription Fee". If this payment link is associated with an invoice, the invoice description is used by default if not specified.
Max length: 128
payer
object
Information about the customer who will use this payment link. Contains the payer account identifier and related customer information. The payer is the party who will submit payment through the link.
accountAccount
object
The expanded payer account object. When included, this provides full account details for the customer who will use this payment link.
Visibility: explicit
account_id ID of Account
string
The unique identifier of the customer account that will use this payment link. This is the account that will make the payment when the link is accessed. If this payment link is associated with an invoice, this must match the invoice payer. (ID prefix: acct)
Pattern: ^acct_[A-Za-z0-9]+$
url
stringRead-only
The secure URL that customers can visit to make a payment. This is a shortened, user-friendly link that redirects to the hosted payment page. Share this URL with customers via email, SMS, or embed it in your application. The link includes authentication credentials and provides access to the payment form. Read-only field that is automatically generated when the payment link is created.
status
enum[string]
The current status of the payment link. Possible values: "active" (link is ready to use but not yet sent), "sent" (email notification has been delivered to the customer), "received" (customer received the email), "opened" (customer clicked the link), "bounced" (email delivery failed), "completed" (payment was successfully processed), "inactive" (link has been manually deactivated), "expired" (link has passed its expiration date). Status automatically updates based on link activity and usage. Read-only field that tracks the payment link lifecycle.
Values: active, sent, received, opened, bounced, completed, inactive, expired
Read-only permissions: "Undocumented"

Checkout Options

checkout_options
object
Configuration options that control the payment checkout experience and available payment methods. Use this to customize which payment options are enabled (cards, bank accounts, digital wallets), whether to collect billing addresses, show payment method previews, enable autopay enrollment, and other checkout behavior. These settings are constrained by the biller account's processing capabilities - you cannot enable payment methods that the account is not provisioned to accept.
auto_billing_toggle
boolean
Display a toggle that allows customers to opt into automatic recurring payments. When true, shows a checkbox or toggle on the payment form where customers can choose to save their payment method as the default for future automatic billing. Useful for subscription or recurring payment scenarios.
bank_account_payments
boolean
Enable or disable bank account payments for this payment link. When true, customers can pay using their bank account and routing number. When false, bank account payment options are hidden. This setting is constrained by the biller account processing capabilities - bank accounts can only be enabled if the account is provisioned for bank account processing. Defaults to the account's bank account processing enabled setting.
billing_address
boolean
Require the customer to provide a billing address during checkout. When true, address fields (street, city, state, postal code) are displayed and required before payment can be submitted. Useful for validation, fraud prevention, and compliance. When false, address collection is skipped. Zip or postal code may still be required based on AVS settings.
card_payments
boolean
Enable or disable credit/debit card payments for this payment link. When true, customers can pay using card details. When false, card payment options are hidden. This setting is constrained by the biller account processing capabilities - cards can only be enabled if the account is provisioned for card processing. Defaults to the account's card processing enabled setting.
default_payment_option
enum[string]
The payment method type that should be selected by default when the checkout page loads. Set to "card" to pre-select card payment option, or "bank_account" to pre-select bank account payment. This provides a suggested payment method but customers can still switch to other enabled options. If not set, the first enabled payment method is shown.
Values: card, bank_account
enable_mobile_wallets
boolean
Enable digital wallet payment options including Google Pay and Apple Pay. When true, customers can use their saved payment methods from Google or Apple wallets for faster checkout. Requires compatible devices and browsers. Improves conversion rates for mobile users.
enable_plaid
boolean
Enable Plaid integration for instant bank account verification and linking. When true, customers can securely connect their bank accounts through Plaid instead of manually entering routing and account numbers. Can help with user experience and reduces errors for bank account payments for certain use-cases.
keep_active_toggle
boolean
Display a toggle that allows customers to save their payment method for future use. When true, shows a checkbox where customers can opt to keep their payment method active in the system after the current payment. When false or unchecked, payment methods are treated as single-use. Helps reduce friction for returning customers.
payment_method_preview
boolean
Display a preview or summary of the entered payment method before final submission. When true, shows customers their entered payment details (masked) for review before confirming the payment. This helps prevent errors and builds customer confidence.
show_disclosure
boolean
Include the standard payment processing disclosure text on the checkout page. When true, displays legal and informational text about the payment processing, terms of service, and related disclosures. Required in some jurisdictions or use cases for compliance.
field_options
object
Configuration for field collection and display behavior on the payment form. Controls what information is collected from customers, whether amounts can be edited, and which custom fields to show. Use these options to customize the payment experience for your specific use case.
amount_field
enum[string]
Controls whether the payment amount can be modified by the customer when accessing the payment link. Set to "editable" to allow the customer to change the amount (useful for donations or variable payments), or "static" to lock the amount to the value specified in the payment link.
Values: editable, static
custom_fields
array
Additional custom form fields to collect from the customer during checkout. Use this to gather extra information beyond standard payment details, such as order notes, service preferences, or custom business data. Each field can be configured with validation, placeholders, and required/optional status.
payer_fields
enum[string]
Controls whether customer information fields (name, email, phone) are displayed on the payment form. Set to "required" to make customer information mandatory, "optional" to allow but not require it, or "disabled" to hide customer fields entirely.
Values: required, optional, disabled

Invoice Association

status
enum[string]
The current status of this invoice. Possible values: "draft" (not yet published/sent), "open" (published and awaiting payment, same as unpaid), "unpaid" (published with no payments), "partially_paid" (some payment received but balance remains), "paid" (fully paid), or "closed" (manually closed/cancelled). Status transitions are restricted - for example, paid invoices cannot be modified.
Values: draft, open, unpaid, partially_paid, paid, closed, sync
totals
object
Financial summary of this invoice, including subtotal, tax, total amounts, and payment status. All fields are read-only and automatically calculated based on the line items and payments associated with this invoice. Provides a quick overview of the invoice's financial state.
balance_due
number (double)Read-only
The remaining unpaid balance on this invoice (total - paid). Read-only field that represents the outstanding amount the payer still owes. When this reaches zero, the invoice is fully paid.
paid
number (double)Read-only
The total amount that has been successfully paid toward this invoice. Read-only field that updates as payments are received and allocated to this invoice. Use this to track how much has been collected.
subtotal
number (double)Read-only
The subtotal of all line items on this invoice before tax is applied. This is the sum of all line item amounts (value * qty for each item). Read-only field that is automatically calculated based on the invoice items. Represents the pre-tax total.
tax
number (double)Read-only
The total tax amount for this invoice. Calculated by applying tax rates to taxable line items. Read-only field that updates when line items or tax rates change. This amount is added to the subtotal to get the total amount due.
total
number (double)Read-only
The total amount due for this invoice (subtotal + tax). This is the full amount the payer owes. Read-only field that is automatically calculated from line items and tax. Represents the complete invoice amount before any payments are applied.
array
Collection of all payment allocations applied to this invoice. Each allocation represents a payment (or portion of a payment) that reduces the invoice balance. Expanded by default to show complete payment history for the invoice.

Next Steps

Enhance invoice payment collection with automated workflows


Optimize Payment Collection

Enable autopay for recurring invoices with Automatic Payments to automatically charge customers on due dates, process invoice payments programmatically with Payment API for automated billing workflows, and provide customer self-service payment management with Payment Portal for hosted payment experiences.

Manage Invoice Workflows

Generate invoices with line items using Creating Invoices for professional billing, track the invoice lifecycle with Invoice Statuses from draft through paid status, and automate recurring invoice creation with Billing Schedules for subscription-based billing.

Monitor Payment Events

Receive real-time notifications for payment completion with Webhook Events to automate post-payment workflows, track payment processing status with Transaction Status to monitor payment completion and failures, and explore general payment link features with Payment Links Overview for advanced payment collection.


Related articles