Skip to content
jovvie.com

Install the Jovvie PHP SDK for Stripe or NMI

This page shows you how to install the Jovvie PHP SDK, create a client with your keys, and check that it can reach the merchant’s account.

There is one SDK for each payment processor. Install the one that matches the merchant’s account. If you support both, you can install both.

  • Get your keys and, for Stripe, your platform provider ID. See Get started.
  • Your server needs:
    • PHP 7.4 or later
    • The PHP curl and json extensions
    • Composer

For Stripe, run:

Terminal window
composer require bizswoop/jovvie-payments

For NMI, run:

Terminal window
composer require bizswoop/jovvie-payments-gateway

Both SDKs are open source:

Then load Composer’s autoloader in your code, if your framework does not already do this:

require __DIR__ . '/vendor/autoload.php';
use JovviePayments\JovviePaymentsClient;
$jovvie = new JovviePaymentsClient(
'YOUR_PUBLIC_KEY',
'YOUR_SECRET_KEY',
'YOUR_PLATFORM_PROVIDER',
'test', // 'live' or 'test'
['userAgent' => 'YourApp/1.0.0']
);

The arguments are:

Argument What to pass
Public key The application’s Public Key
Secret key The application’s Secret Key
Platform provider ID The platform provider ID you got from Jovvie support. It is required
Mode 'live' for real payments or 'test' for test payments. The default is 'live'
Options An array. Set userAgent to your app’s name and version, such as YourApp/1.0.0. It is added to the requests your integration sends

In your real code, read the keys and the platform provider ID from environment variables or a secrets manager instead of typing them into the file.

The main services are:

Method Use it to
$jovvie->payments() Create one-time and recurring payments, and get a payment by its ID
$jovvie->authorizationLinks() Create links that unlock card readers for staff
$jovvie->accounts() Get details of the merchant’s account
use JovviePaymentsGateway\JovviePaymentsGatewayClient;
$gateway = new JovviePaymentsGatewayClient(
'YOUR_PUBLIC_KEY',
'YOUR_SECRET_KEY',
['userAgent' => 'YourApp/1.0.0']
);

The NMI client does not take a platform provider ID or a mode.

The main services are:

Method Use it to
$gateway->payments() Create a payment and get a payment by its ID
$gateway->devices() List, register, and remove the merchant’s NMI terminals
$gateway->accounts() Get details of the merchant’s account

To check that your keys work, get the merchant’s account name. This makes a real request but does not create a payment.

For Stripe:

$self = $jovvie->accounts()->self();
echo $self->account->name;

For NMI:

$self = $gateway->accounts()->self();
echo $self->name;

If the keys, the platform provider ID, or the merchant’s account are not right, the SDK throws an exception. See Handle errors.

With Stripe, you choose the mode when you create the client. The same keys and platform provider ID work in both modes, so you only change the fourth argument:

  • 'test': no real card is charged. Use this while you build and test.
  • 'live': real payments.

Any other value throws an InvalidArgumentException. Creating a live client with a platform provider ID that works in test mode only also throws an InvalidArgumentException.

Payments, card readers, and authorization links in one mode do not appear in the other. Make the mode a setting in your integration, so the merchant can switch without a code change.

The NMI SDK has no test mode. Every payment you create with it is real. See Test your integration.