Last updated: November 13, 2026
When a payer chooses to pay with a credit or debit card in PayPal Checkout, the PayPal buttons show a card form with its own submit button.
You can change this behavior so that:
Use this customization when your checkout page already has a primary action, such as a Place order button, and you want payers to complete card payments with it.
This feature modifies an existing PayPal Checkout integration and uses the following:
Set expandCardForm to true when you call paypal.Buttons(). The card form expands when the buttons render, so payers don't need to select the card button first.
paypal.Buttons({
expandCardForm: true,
createOrder: function (data, actions) {
// Create the order, called when the buttons render if expandCardForm is true
},
onApprove: function (data, actions) {
// Capture the order
},
}).render("#paypal-button-container");To submit the card form from your own button:
expandCardForm to true.hideSubmitButtonForCardForm to true to hide the card form's Pay button, which shows the order amount.paypal.Buttons() to a variable before you render it.submitCardForm() on that variable when the payer selects your button.const paypalButtons = paypal.Buttons({
expandCardForm: true,
hideSubmitButtonForCardForm: true,
createOrder: function (data, actions) {
// Create the order
},
onApprove: function (data, actions) {
// Capture the order
},
onError: function (err) {
// Show an error message to the payer
},
});
paypalButtons.render("#paypal-button-container");
// Call this function from your own submit button
function onSubmitClick() {
paypalButtons.submitCardForm();
}<div id="paypal-button-container"></div>
<button type="button" onclick="onSubmitClick()">Place order</button>Set expandCardForm to true when you use hideSubmitButtonForCardForm, and provide a button that calls submitCardForm(). Payers can then use your page's button to submit their card details.
When your page calls submitCardForm(), the method returns a promise that resolves without a value. Use your callbacks to handle the result:
onApprove runs after the payer's card payment is approved.onError runs if an error prevents the payment from completing.The callbacks run after the card form passes field validation. If a required field is empty or contains a value that isn't valid, the form highlights it so the payer can correct it and select your button again.
Test the card form in the sandbox with a test card number. Real card numbers don't work in the sandbox.
onApprove runs and that your server captures the order.| Option or method | Type | Description |
|---|---|---|
expandCardForm | boolean | If true, the card form expands automatically when the buttons render. |
hideSubmitButtonForCardForm | boolean | If true, hides the card form's Pay button. |
submitCardForm() | function | Submits the card form and returns a promise. Call it on the object returned by paypal.Buttons(). |
Existing integrations keep the default behavior: the payer selects the card button to open the form, and PayPal shows the form's Pay button.