Add Pay Later messages
Follow these steps to integrate Pay Later messages
Follow these steps to add Pay Later messages.
Know before you code
- Complete Get started to set up your PayPal account, client ID, and sandbox emails for testing.
- Complete a standard PayPal checkout integration (recommended).
Add Pay Later Messages
YOUR_CLIENT_IDwith your client ID.
- Change the
data-pp-amount="500.00"to display Pay Later messaging with a different payment amount.
Determine where the SDK should render messaging, and PayPal determines the best Pay Later message to display on your website. You can control the format of the message using configuration attributes.
Note: See the message placement section to learn how to effectively present Pay Later messaging throughout your site.
<script src="https://www.paypal.com/sdk/js?client-id=YOUR-CLIENT-ID¤cy=EUR&components=messages"> </script> <div data-pp-message data-pp-placement="product" data-pp-amount="500.00"> </div>
Note: Your website should update the
data-pp-amountattribute shown in the example above for each product price or cart amount. If you omit this attribute or include a non-qualifying amount, the message will include additional content indicating Pay in 4X is only available for eligible purchases.
Test and Go Live
When you’re ready to take your integration live, test your integration in your sandbox environment and go live.
1. Test Pay in 4X
Use your personal sandbox login information during the checkout flow to complete a Pay Later transaction and then log into the sandbox test site,
sandbox.paypal.com, to see the money move out of the buyer's account.
Use the business sandbox login information to log into
sandbox.paypal.com to see the money move into the merchant's account.
Note: Learn more about the PayPal sandbox: PayPal sandbox.
- Log in to your buyer account in your sandbox.
- On the PayPal Checkout page, choose PayPal as your payment method at the time of purchase.
- Select Pay in 4X as the payment option.
- Follow the on-screen instructions to send a payment to your merchant account in your sandbox.
- Log in to your merchant sandbox account and confirm the money you used to Pay in 3 move to the merchant account.
2. Test the Pay Later messaging
Test the script by replacing
YOUR_CLIENT_ID with your sandbox client ID, and make sure Pay Later messaging displays on your website.
3. Go live with your integration
Deploying your code to the live environment takes only a few steps.
Change the references to your sandbox API credentials to the live credentials. To get live API credentials, create a live REST API.
- If you created or updated pages on a website, move that code from the test environment to the live environment.
Once your code is live, you can:
Test the button and movement of funds using real (non-sandbox) PayPal accounts. When making a live test purchase, consider:
- The business account receiving money can’t also make the purchase.
- If you create a personal account with the same information as the business account, those accounts might experience restrictions.
To assist developers in integrating pay later offers, the message component and console warnings and errors include configuration attributes and object validation. The various configuration properties have distinct validation checks for input formatting, and values to ensure validity. See the reference tables for a full list of accepted options.
If the validation fails, the web browser's developer console displays warning messages showing which property is invalid and what developers should do to resolve the issue. Depending on the message type, the library attempts to fall back to the default values.
Other messaging options
You can modify the style and layout of your messages.
|Get started||Get started|