Skip to content

Set up PayPal Auto-Pay

PayPal Auto-Pay charges clients’ PayPal accounts automatically through PayPal billing agreements: the client agrees once at PayPal, and their invoices are then paid from their PayPal account, as with WHMCS’s PayPal billing agreement gateways.

Use it only if PayPal does not offer saved PayPal accounts (the Vault) in your country: check PayPal’s list of supported countries. If your country is on the list, use the PayPal gateway with its REST API keys instead, which saves clients’ PayPal accounts the modern way (see Set up Stripe and PayPal).

Your PayPal business account must have Reference Transactions turned on. PayPal turns them on only on request: contact PayPal Merchant Support and ask for Reference Transactions on your account. Without them, ClientFence refuses to save the gateway and shows PayPal’s error.

  1. In PayPal, open Account Settings → Website payments → API access → Update, and under NVP/SOAP API integration (Classic) select Manage API credentials, then choose an API signature.
  2. Install PayPalAutoPay on System → Payment Gateways and open it.
  3. Copy the API username, API password and API signature into the Live fields.
  4. Turn on Enabled and select Update Gateway. ClientFence checks with PayPal that the details work and that Reference Transactions are on.
  5. Turn on PayPal’s notifications, below.

In PayPal, open Account Settings → Notifications → Instant payment notifications, turn them on, and set the URL to the gateway’s IPN Callback URL (shown on the gateway’s page in ClientFence). With it:

  • A client who cancels the agreement in their PayPal account loses the saved method at once.
  • A payment PayPal holds (an eCheck, for example) is marked paid when PayPal completes it.

PayPal also sends news of each payment, such as a chargeback, to the address ClientFence gives with that payment. Without the notification URL, a cancelled agreement is still removed the first time ClientFence tries to charge it and PayPal says it is cancelled.

Turn on Test mode and fill in the Sandbox fields with the API Credentials of a sandbox business account (developer.paypal.com, Sandbox accounts), then pay an invoice with a sandbox personal account. To test with real money instead, use a second PayPal account of your own and refund the payment from the invoice afterwards.

Setting What it does
Pay with the saved agreement A Pay now button on the invoice that pays at once (on by default).
Pay once without an agreement A Pay once with PayPal button (on by default). Off: clients can only pay by setting up automatic payments.
Set up on the Payment methods page Clients agree without paying an invoice (on by default).
Free orders After a free order that renews, such as a free trial, a client without a saved payment method goes to PayPal to set up automatic payments (on by default).
Convert to for processing A currency code of this portal, such as USD. Invoices in other currencies are charged in it at the portal’s exchange rates (System → Settings → Currency). Empty: each invoice is charged in its own currency.
Fill in the client’s email at PayPal PayPal’s checkout page starts with the client’s email (on by default).
Logo on PayPal’s pages The image PayPal’s checkout pages show. Empty: your company logo, if it is a PNG, JPG or GIF.
PayPal balance on the dashboard The account’s balance on the admin dashboard (on by default).

With Convert to for processing, an invoice of 500 EGP is charged as its USD value, and the payment pays the invoice in full. A refund sends back the same share of the USD payment. The transaction shows what PayPal took, for example “PayPal: 9.28 USD.”

On the invoice, the account owner selects Pay with PayPal and set up automatic payments, or, once the agreement exists, Pay now with their PayPal account. The agreement is the client’s saved method, charged as described in Saved cards and PayPal accounts. Staff can charge it now with Charge on the invoice.

A payment PayPal holds shows as Payment pending until PayPal completes it. A client who cancels the agreement in PayPal, or removes it on their Payment methods page, is no longer charged. A chargeback refunds the payment on its invoice (a credit note), moves the renewed services’ due dates back by their period, and leaves a note on the invoice.

The WHMCS import can bring clients’ billing agreements over, so they do not agree again: set PayPal billing agreements to Import (see Import from WHMCS). Use the same PayPal API details in both, and on the day you move, stop WHMCS from charging the agreements and point PayPal’s IPN URL at ClientFence.