Safely Saving Gateway API Credentials
ProRequires Events Manager Pro. Compare plans
Payment gateways need API credentials: Stripe's secret key, PayPal's client secret, Square's access token, Authorize.net's transaction key. Anyone who has them can act on your payment account, so Events Manager Pro only shows and accepts them over an encrypted connection.
On the [Live] API Keys/Notifications tab of a gateway (Events then Payment Gateways):
- When wp-admin is loaded over HTTPS, each credential has a normal text field.
- When it is not, the fields are replaced by the saved values with everything but the first and last character shown as asterisks, and a red notice explains that your site is not using SSL. Nothing can be typed or saved.
This is a display and transport protection. The credentials are saved in your WordPress database as ordinary settings, so the usual advice applies as well: keep database backups private and limit who has administrator access.
The fix: use HTTPS
Serve your site, or at least wp-admin, over HTTPS. Most hosts provide a free certificate. To force wp-admin onto HTTPS, add this to wp-config.php:
define( 'FORCE_SSL_ADMIN', true );
HTTPS is needed for more than this screen. The Stripe, PayPal and Square gateways are not offered on booking forms without it, and the Authorize.net gateways are switched off in live mode without it.
My site is on HTTPS but the fields are still locked
WordPress decides whether a request is secure from what your server tells it. Behind a load balancer, a reverse proxy or a CDN that handles HTTPS for you, the request can reach WordPress as plain HTTP, and WordPress then reports the page as insecure even though your browser shows a padlock.
The proper fix is to have WordPress recognize the forwarded connection. WordPress documents this under Administration Over SSL, and your host can usually set it up for you.
If you are certain that the connection between browsers and your site is encrypted, you can also tell Events Manager Pro to show the fields regardless:
define( 'EMP_GATEWAY_SSL_OVERRIDE', true );
With this constant defined on a site that has no HTTPS at all, your live credentials travel across the network unencrypted every time the settings page is opened or saved.
Test credentials are the exception
Sandbox and test credentials can't move real money, so the [Test] API Keys/Notifications tab is more relaxed. Without HTTPS it shows the message If you are only using testing credentials, you can display and save them safely. with a Show API Keys button. Click it to reveal the fields for that visit.
Don't use this to save live credentials in the test fields.
If you can't use HTTPS at all
Then you can't safely type credentials into wp-admin, and for most gateways there is little point in trying, because they won't run on the front end either. The one gateway this affects in practice is the legacy PayPal (Payments Standard), whose optional API credentials are used only on the server.
In that case, save the credentials over a channel that is encrypted, such as SSH. With WP-CLI on the server:
wp option update em_paypal_api '{"username":"<api-username>","password":"<api-password>","signature":"<api-signature>"}' --format=json
Replace the three placeholders with your own values. Afterwards the gateway's API tab shows the first and last character of each saved value, which is how you can tell it worked.