View Categories

PayPal and PublishPress Cart

PublishPress Cart lets your customers pay with PayPal. This guide shows you how to get your PayPal API credentials, connect them to Cart, and test a payment.

PayPal is an online payment service. Cart can take PayPal payments in a popup on your site, or send customers to paypal.com to pay.

This integration is available in PublishPress Cart Free and Pro.


Before you start #

You need:

  • PublishPress Cart Free or Pro installed and active.
  • A PayPal business account.
  • A site with a public HTTPS address. PayPal cannot reach a local site such as localhost or .local.

Cart asks for these items from PayPal:

Field in CartWhere to find it
PayPal Email / Sandbox EmailThe email of your PayPal business account, or your sandbox business account.
Client ID / Sandbox Client IDYour app in the PayPal Developer Dashboard.
Secret / Sandbox SecretYour app in the PayPal Developer Dashboard.
PDT Token / Sandbox PDT TokenOptional. Only for the Redirect to PayPal checkout. See “Get the PDT token for Redirect to PayPal”.

You do not need to create a webhook or turn on IPN yourself. Cart registers the PayPal webhook for you when you save your Client ID and Secret.

If you use Redirect to PayPal, Cart sends its own IPN (Instant Payment Notification) URL with each order, so you do not need to enter one. Make sure IPN is not turned off in your PayPal account, under Account Settings → Website payments → Instant payment notifications. Without IPN, subscription renewals, refunds and cancellations do not reach Cart.


Open the PayPal Developer Dashboard #

  1. Go to developer.paypal.com and log in with your PayPal business account.
  2. Click Apps & Credentials in the left menu.
  3. Use the Sandbox / Live switch in the top-left corner to choose the mode. Start with Sandbox to test.

The Apps & Credentials page lists your apps and their credentials:

PayPal Developer Dashboard Apps and Credentials page in sandbox mode

Create a REST API app #

  1. Click Create App.
  2. Enter an App Name, for example the name of your store.
  3. Keep the type as Merchant.
  4. In sandbox mode, choose the Sandbox Business Account that receives the test payments.
  5. Click Create App.

In the Create App window, enter the name and choose the sandbox business account:

PayPal Create App window with the app name, Merchant type and sandbox business account

Copy the Client ID and Secret #

PayPal opens the app page. In the API credentials section:

  1. Copy the Client ID.
  2. Click the eye icon next to Secret key 1 to show it, then copy it.

The Client ID and Secret key 1 are on the app page:

PayPal app page with the Client ID and Secret key 1

Keep your Secret private. Do not share it in emails, screenshots or support tickets.


Find your sandbox business email #

For sandbox mode, Cart also needs the email of the sandbox business account.

  1. Go to Testing Tools → Sandbox Accounts.
  2. Copy the email of the Business account that you chose when you created the app.

The Sandbox test accounts page lists the Business and Personal accounts:

PayPal Sandbox test accounts page listing Business and Personal accounts

The Personal account on this page is your test buyer. Use it to log in at PayPal when you test a payment. To see its password, click the ⋮ menu, then View/edit account.


Connect PayPal in Cart #

  1. In WordPress, go to Cart → Settings → Payment Methods.
  2. Find PayPal and click Manage PayPal.

PayPal has its own Manage PayPal button on the Payment Methods tab:

Payment Methods tab with the Manage PayPal button
  1. Turn on Enable PayPal.
  2. Select Sandbox to test, or Live to accept real payments.
    • On this page (PayPal popup): the customer pays in a PayPal popup and stays on your site. This option needs the Client ID and Secret.
    • Redirect to PayPal: the customer goes to paypal.com to pay and then returns to your site.
    Choose the Checkout experience:
  3. Enter the Email, Client ID and Secret for the selected mode.
  4. Click Save PayPal.

The Manage PayPal window shows the sandbox fields, with the checkout experience and credentials:

Manage PayPal window in sandbox mode with checkout experience, email, client ID and secret fields

After you save, the note under Checkout experience shows “PayPal webhook registered for sandbox mode at …”. This tells you that Cart registered the webhook with PayPal.

The Secret field is empty after you save. This is normal. Cart does not show a saved Secret. Leave the field blank to keep the current value.


Check the webhook #

Optional: open your app in the PayPal Developer Dashboard and scroll down to Sandbox Webhooks (or Live Webhooks). You see a webhook that ends with /ppcart-webhook/paypal-rest:

PayPal Sandbox Webhooks list with the Cart webhook ending in ppcart-webhook/paypal-rest

If PayPal refused the webhook, Cart shows the error under Checkout experience. The note gives the URL and events to add by hand. Until you add it, Cart checks pending PayPal payments every hour.


Test a payment #

  1. Open a product page on your site.
  2. Fill in the form and select PayPal under Payment info.
  3. Click Order Now.
  4. Log in with your sandbox Personal account and approve the payment.
  5. In WordPress, go to Cart → Orders. The order status is Paid.

The checkout form shows PayPal under Payment info:

Checkout form with PayPal selected under Payment info

Connect PayPal in live mode #

  1. In the PayPal Developer Dashboard, switch to Live.
  2. Open Apps & Credentials, create a live app (or open your app), and copy the live Client ID and Secret.
  3. In Cart → Settings → Payment Methods → Manage PayPal, select Live.
  4. Enter your PayPal business Email, the live Client ID and the live Secret.
  5. Click Save PayPal. Cart registers a live webhook for you.

In live mode, Manage PayPal shows the live fields:

Manage PayPal window in live mode with email, client ID and secret fields

Get the PDT token for Redirect to PayPal #

This section is optional. The PDT (Payment Data Transfer) token is only for the Redirect to PayPal checkout. Cart uses it to confirm the payment when the customer returns from PayPal. The on-page (popup) checkout does not use it.

  1. Log in at paypal.com (live) or sandbox.paypal.com with your sandbox business account.
  2. Go to Account Settings → Website payments → Website preferences and click Update.
  3. Turn on Auto return and enter any return URL. Cart sends its own return URL with each order.
  4. Turn on Payment data transfer and copy the Identity Token.
  5. Paste it into PDT Token (or Sandbox PDT Token) in Cart.

Fix common PayPal problems #

    • The Client ID or Secret for the selected mode is empty or wrong.
    • An ad blocker or tracker blocker in the browser blocks PayPal’s script. Some browsers have one built in. Turn it off for your site, or test in another browser.
    The checkout goes to paypal.com, but I chose “On this page (PayPal popup)”: Cart falls back to the redirect when the PayPal script cannot start. Check these causes:
  • The order stays “Pending” after payment: Check that the webhook note in Manage PayPal says “registered”. If PayPal refused it, add the webhook by hand with the URL and events in the note.

Video guide to PayPal and PublishPress Cart #

How to Connect Your PayPal Account to PublishPress Cart