1. Home
  2. WHMCS + PayPal Billing Gateway
  3. Documentation
  4. How does the PayPal Billing Gateway work with WHMCS / credit cards?

How does the PayPal Billing Gateway work with WHMCS / credit cards?

Our PayPal Billing Agreement module/gateway is built to relieve the pain of using Subscriptions to charge clients – using PayPal Billing Agreements instead: a more robust method to charge clients varying amounts on a recurring basis. Read more about Billing Agreements / Reference Transactions here.

Token Storage in WHMCS

When our gateway creates a Billing Agreement for a client (read more about how a billing agreement is created here) – this Billing Agreement is stored as a token (B-1029398338448) under the clients account. This token is used by our gateway to charge the client for future payments. Due to how WHMCS handles gateway tokens, the token must be stored in tblclients>gatewayid.

WHMCS does not allow more than one gateway token to be on file at one time – which although not most convenient, does make sense – as it’s not common to see a client continuously switch between major payment methods on their account. Because of this, our gateway handles token storage with a few different logic methods:

  1. If a different token is stored on the client’s account (i.e. credit card, etc) – and the client pays with our gateway, a Billing Agreement will be created and our gateway will sense the foreign token which it will clear to make room for the Billing Agreement token to be stored on the client’s account.
  2. If a Billing Agreement token is on file, and the client attempts to pay with a different method (i.e. credit card), the credit card gateway will usually not be smart enough to clear out the Billing Agreement token first, and will most likely error out. This is why we build in a special module option in Configuration to clear out the gatewayid when a payment method is changed for an invoice. You can enable this in our Module Configuration to allow for easier payment method switching.

Gateway Type in WHMCS

Because of the way our gateway works: Directing the user to PayPal when they first make a payment, then keeping a token on file and automatically charging them for future payments: our gateway falls under a “credit card gateway” classification in WHMCS, instead of a normal third-party gateway, linking the user to a 3rd party site.

As such, the credit card settings in Setup > Automation > Credit Card Charging Settings will apply to our gateway, and control how it charges clients.

The value set in Process Days Before Due will control how our gateway charges invoices based on the day they are due – just like a normal credit card gateway.

Updated on December 16, 2017

Was this article helpful?