Add Pay Later messages

DocsCurrent

Last updated: Mar 14th, 6:16pm

Select your country or region

Australia France Germany Italy Spain United Kingdom United States

Integrate Pay Later messages and buttons to show customized payment offers for your payers.

Know before you code

Required
Complete Get Started

Complete Get Started to set up your PayPal account, client ID, and sandbox emails for testing.

Render Pay Later messaging and buttons

Choose where you want to render the Pay Later messaging, and PayPal automatically displays the most appropriate message. You can also customize the formatting using configuration attributes. For more details, see message placement.

  1. Add the PayPal JavaScript SDK code to your product and checkout pages.
  2. Replace YOUR_CLIENT_ID with your client ID.
  3. To display messaging with a different payment amount, change the 120.00 in data-pp-amount="120.00".
    1<script src="https://www.paypal.com/sdk/js?client-id=YOUR-CLIENT-ID&currency=EUR&components=messages,buttons&enable-funding=paylater">
    2</script>
    3
    4<div id="paypal-button-container"></div>
    5
    6<script>
    7 paypal.Buttons({
    8 createOrder: function(data, actions) {
    9 return actions.order.create({
    10 purchase_units: [{
    11 amount: {
    12 value: '120.00'
    13 }
    14 }]
    15 });
    16 }
    17}).render('#paypal-button-container');
    18</script>
    19
    20<div
    21 data-pp-message
    22 data-pp-amount="120.00">
    23</div>

    Step result

    Our example renders a Pay Later message that displays each payment amount for 40€. However, a different message could render, based on the amount passed through data-pp-amount.

    Example,message

    Example,button

    Test and go live

    1. Test Pay Later transactions

    1. Log in to your buyer account in your sandbox.
    2. On the PayPal Checkout page, choose PayPal as your payment method at the time of purchase.
    3. Select Paga in 3 rate as the payment option.
    4. Follow the on-screen instructions to send a payment to your merchant account in your sandbox.
    5. Log in to your merchant sandbox account.
    6. Confirm that the money successfully moved into the merchant account.

    To learn more about the PayPal sandbox, see the sandbox testing guide.

    2. Test Pay Later messaging

    1. Within the PayPal JavaScript SDK, replace YOUR_CLIENT_ID with your sandbox client ID.
    2. Confirm that Pay Later messaging displays in all appropriate pages.

    3. Go live

    1. Change all references to your sandbox API credentials to live credentials. This includes changing the sandbox client ID in the PayPal JavaScript SDK to call in your HTML.
    2. If you created or updated pages on a website, move that code from the test environment to the live environment.

    If you want to test live Pay Later transactions using real funds and non-sandbox PayPal accounts, ensure the following:

    • The business account receiving the money can’t also make the purchase.
    • Don't use a personal account with the same information as the business account, as these accounts might experience restrictions.

    Troubleshooting

    Message components, console warnings, and errors include configuration attributes and object validations. Configuration properties have distinct validation checks for input formatting and values. For a full list of accepted options, see the reference.

    If validations fail, the developer console in your web browser displays warning messages that inform you which property is invalid and what you should do to resolve the issue. Depending on the message type, the library attempts to fall back to the default values.