On this page
No Headings
Last updated: July 20, 2026
Version notice: This integration uses Vault v2. Vault v3 is now available in the United States. Payment tokens created with Vault v2 are fully compatible with Vault v3. You can upgrade to v3 at any time.
Important: Vaulting payment methods is a limited-release solution available to select merchants and partners as a pilot. Contact your sales or account manager to inquire about the pilot. You may need to configure your developer account to use vaulting in both the sandbox and production environments separately. To use vaulted card information in a transaction, you must follow the onboarding and vetting process for advanced credit and debit card processing. To use a vaulted PayPal wallet in a transaction, you must be approved for PayPal Billing Agreements.
Warning: To continue providing a Pay Later option at checkout, it is essential that you integrate Billing With Purchase. This solution offers the same functionalities as Billing Agreement and is compatible with your existing payment options.
Vaulting securely saves your buyers' payment information and streamlines their checkout experience.
When a buyer on your website saves their payment method, PayPal creates a customer record. PayPal then encrypts the payment method information and stores it in a digital wallet for that customer which is accessible only by you.
The checkout process is now shorter because it uses the saved payment information.
To vault a PayPal account, buyers need to log in to your site to check out and remain present on your site when transactions take place.
Before you can vault payment methods, your sandbox business account has to be enabled by PayPal for this capability.
Sign into www.sandbox.paypal.com/bizsignup/entry/product/ppcp with your sandbox business account that you obtained from the Dashboard. Sandbox requests are automatically approved so you can build and test your integration. Before you test and go live, you'll repeat this process for your merchant account in the production environment.
Only your sandbox business account is enabled for vaulting payment methods, and your developer account remains unaffected.
You'll complete production onboarding when you're ready to go live.
Tip: When prompted for required data like a phone number for the sandbox business request, enter any number that fits the required format. Since this is a sandbox request, the data doesn't have to be factual.
Pass the customer ID to PayPal to generate a client token. The customer ID is a unique ID for a customer in your system of records and the client token uniquely identifies each buyer. You use the client token in Step 3.
Copy the following code and modify it.
curl -v POST https://api-m.sandbox.paypal.com/v1/identity/generate-token \
-H 'Accept: application/json' \
-H 'Accept-Language: en_US' \
-H 'Authorization: Bearer <ACCESS-TOKEN>' \
-H 'Content-Type: application/json' \
-d '{
"customer_id": "customer_1234"
}'Access-Token to your sandbox access token.customer_1234 with a unique customer ID for each buyer who logs into your site. Make sure the customer ID:
A successful request results in a client token and the number of seconds the token is valid. You can generate a new client token if the current token expires.
Tip: Because each buyer session is unique, set up your server to generate a new client token each time you render your checkout page.
{
"client_token": "eyJicmFpbnRyZWUiOnsiYXV0aG9yaXphdGlvbkZpbmdlcnByaW50IjoiYjA0MWE2M2JlMTM4M2NlZGUxZTI3OWFlNDlhMWIyNzZlY2FjOTYzOWU2NjlhMGIzODQyYTdkMTY3NzcwYmY0OHxtZXJjaGFudF9pZD1yd3dua3FnMnhnNTZobTJuJnB1YmxpY19rZXk9czlic3BuaGtxMmYzaDk0NCZjcmVhdGVkX2F0PTIwMTgtMTEtMTRUMTE6MTg6MDAuMTU3WiIsInZlcnNpb24iOiIzLXBheXBhbCJ9LCJwYXlwYWwiOnsiYWNjZXNzVG9rZW4iOiJBMjFBQUhNVExyMmctVDlhSTJacUZHUmlFZ0ZFZGRHTGwxTzRlX0lvdk9ESVg2Q3pSdW5BVy02TzI2MjdiWUJ2cDNjQ0FNWi1lTFBNc2NDWnN0bDUyNHJyUGhUQklJNlBBIn19",
"expires_in": 3600
}Pass the client token from your server into the PayPal JavaScript SDK using data-client-token.
<script src="https://www.paypal.com/sdk/js?client-id=YOUR_CLIENT_ID" data-client-token="YOUR-CLIENT-TOKEN"></script>Set the width of your button to be 350 px or greater to allow for button content. Otherwise your button behavior reverts to a standard button and won't offer the option to pay with a saved payment method. See the button style options for more information.
Run the following tests in the PayPal sandbox to ensure vaulting the payment method is set up correctly.
You've completed the steps to vault a PayPal account.
These steps modify your advanced credit and debit card payments integration. Your eligibility for advanced credit and debit card payments enables you to save cards.
Add a checkbox element grouped with your card collection fields to allow buyers the option to save their card.
<div>
<input type="checkbox" id="vault" name="vault">
<label for="vault">Save your card</label>
</div>Pass vault: document.querySelector('#vault').checked with the value of the checkbox when submitting the advanced credit and debit card payments instance.
// Check eligibility for advanced credit and debit card payments
if (paypal.HostedFields.isEligible()) {
// render hosted fields
paypal.HostedFields.render({
//This sample function returns the order ID
createOrder: () => {
// logic to return an order ID from your server
},
fields: {
number: {
selector: '#card-number',
placeholder: 'card number'
},
cvv: {
selector: '#cvv',
placeholder: 'CVV',
},
expirationDate: {
selector: '#expiration-date',
placeholder: 'mm/yyyy'
}
}
}).then(function (hf) {
document.querySelector('#my-sample-form').addEventListener('submit', (event) => {
event.preventDefault();
hf.submit({
// pass the value of the checkbox when submitting the advanced credit and debit card payments instance
vault: document.querySelector('#vault').checked
}).then(function (payload) {
// Make a call to capture the order (payload.orderId) here
});
});
});
}
else {
/*
* Handle experience when advanced credit and debit cards is not eligible
*/
}Acceptable input values for vault:
| Value | Description |
|---|---|
true | Card entered by the buyer is requested to be saved. Card shows as a one-click button when buyer returns to your website. |
false | Card entered by the buyer is not requested to be saved. |
When your buyer isn't present to checkout, you can get their payment tokens to create transactions using the payment methods that are saved by your buyers.
Test in the PayPal sandbox to ensure vaulting is set up correctly.
You've complete the steps to vault cards for advanced credit and debit card payments.
To test your card fields integration in your sandbox environment, please choose cards from this list of positive test card numbers.