Table of contents

Prefilling fields on the payment page

If you collect a user’s details in your service before you redirect them to GOV.UK Pay, you can prefill some of the fields on the Enter card details page. If you prefill fields, users should not need to enter their details twice.

Users can still edit these details before they complete their payment.

To prefill fields, include the following optional parameters in the API request when you create a new payment:

  • email
  • prefilled_cardholder_details - with optional cardholder_name and billing_address parameters

For example:

"email": "",
"prefilled_cardholder_details": {
    "cardholder_name": "Sherlock Holmes",
    "billing_address": {
        "line1": "221 Baker Street",
        "line2": "Flat b",
        "postcode": "NW1 6XE",
        "city": "London",
        "country": "GB"

All the parameters in billing_address are optional, and these parameters’ values must be no longer than:

  • 254 characters for email
  • 255 characters for cardholder_name
  • 255 characters each for line1, line2 and city in billing_address
  • 25 characters for postcode in billing_address

If you include the country parameter, it must be an ISO 3166-1 alpha-2 code. If the parameter is invalid or missing, the Country or territory field on the payment page will default to ‘United Kingdom’.

Refer to the API browser or the Swagger file for more information.

Data collected by your GOV.UK Pay admin account

After the user completes their payment, your GOV.UK Pay admin account will collect the user’s:

  • email address - even if you’ve disabled collecting your users’ email addresses
  • cardholder name
  • billing address

If the user does not complete their payment, your GOV.UK Pay admin account will still collect the billing_address value. This will happen even if you’ve chosen not to collect your users’ billing addresses.