/coinbase-commerce-whmcs

A simple WHMCS gateway that uses the new Coinbase Commerce merchant tools https://commerce.coinbase.com/

Primary LanguagePHPGNU General Public License v3.0GPL-3.0

WHMCS Coinbase Commerce Gateway Module

Summary

This is a payment gateway module for for the new Coinbase Commerce.

On May 1st, 2018 Coinbase disabled all legacy API and merchant tools, but they released an even better tool to replace it, Coinbase Commerce.

Coinbase Commerce is a simple powerful interface to generate checkouts or charges for your customers without having to pay them any fees and while keeping full control of your private keys.

As of right now Coinbase Commerce is very new and their API is ready for payments but some features are missing. We go over this in the To Do section.

Note

If someone sends a payment under or over what their invoice total is, then the payment will fail. You can still manually add the Payment in WHMCS but the CC API system sends it with the failed result and the user is notifed of this as well. Just like this screenshot. Ideally we wouldn't want this to happen and if anyone has some suggetsion around this please suggest it.

Contributions and requests are very welcome. Simply open an issue with as much detail as possible.

Installation

  1. Visit https://commerce.coinbase.com/ and login or sign-up for a free account.

  2. Generate an API key on the settings page . https://commerce.coinbase.com/dashboard/settings Keep these values super safe.

  3. Get your Webhook shared secret from the Webhook subscriptions section on the same page as above. Keep these values super safe.

  4. Clone or download this project to your local machine or to your webserver.

  5. Copy the modules directory into your WHMCS root folder. This will place the files in the needed locations. Below is the complete file structure that should be uploaded. Make sure you don't upload any of the files like this readme into your WHMCS installation.

 modules/gateways/
  |- callback/coinbasecommerce.php
  |  coinbasecommerce.php
  1. Activate the Payment Gateway. To do this visit your Payment Gateways in WHMCS. This is located at : Setup -> Payments -> Payment Gateways. This Module will be called Coinbase Commerce.

  2. Customize your gateway settings with the information we gathered above.

  3. Update your webhook URL to point to your callback file. Paste the full URI of where your callback file is something like: https://www.yourwebsite.com/whmcs_root/modules/gateways/callback/coinbasecommerce.php. So that your logs don't fill up super fast make sure you only select charge:confirmed and charge:failed. See the screenshot below for an example of how you should set up your webhook. You should now be set!

Minimum Requirements

We have no additional requirements beyond what WHMCS already needs.

For the latest WHMCS minimum system requirements, please refer to https://docs.whmcs.com/System_Requirements

To Do

  • Implement a Logo URL as soon as Coinbase gets around to letting us declare it for charge type transactions.
  • Implement logic to tell if multiple payments have been made and act accordingly.
  • Clean up this super sloppy code, ugh.