Listen for the primer:ready event to access the Primer SDK instance
Retrieve the user’s name from your authentication system or profile data
Call primer.setCardholderName() with the name value
When using setCardholderName(), you don’t need to include the <primer-input-cardholder-name> component in your form if you don’t want users to edit the name.
Create a PrimerCardFormController using rememberCardFormController()
Call updateCardholderName() with the user’s name inside a LaunchedEffect
The field will display the prefilled name and the user can edit it if needed
updateCardholderName() sets the field value programmatically. The customer can still edit the prefilled name. The same approach works for other fields — use updateCardNumber(), updateExpiryDate(), or updateCvv() as needed.
Access PrimerCardFormScope via getPaymentMethodScope() in the scope closure
Call updateCardholderName() with the user’s name
The field displays the prefilled name and the user can still edit it
The same approach works for other fields — use updateCardNumber(), updateExpiryDate(), or updateCvv() as needed.
checkout.addEventListener('primer:ready', (event) => { const primer = event.detail; // Get name from shipping form const shippingName = document.getElementById('shipping-name').value; if (shippingName) { primer.setCardholderName(shippingName); }});
If you want to pre-fill but still allow editing, include the cardholder name input and set an initial value:
Web
Android
iOS
checkout.addEventListener('primer:ready', (event) => { const primer = event.detail; const user = getAuthenticatedUser(); if (user?.fullName) { // Pre-fill the value primer.setCardholderName(user.fullName); // The <primer-input-cardholder-name> component will show this value // and users can still edit it }});