Stripe API | Nova Framework | Tutorials

David Carr

Getting Stripe API setup with Nova Framework

This post will guide you on using Stripe’s API with Nova Framework

Install Stripe’s PHP library by including it in your composer.json file:

composer require stripe/stripe-php

Before starting with Stripe create a Stripe.php file in app/Config and enter your API secret and public key, also set your webhookSecret if you plan on using Stripe’s webhooks.

Go to to manage your API keys.

return array(
    'apiSecretKey' => 'your-secret-key-here',
    'apiPublicKey' => 'your-public-key-here',
    'webhookSecret' => 'your-webhook-key-here',

This allows the API to access the keys without having them littered in your code.

In the controller, you’ll be using with Stripe import the classes you’ll be using. 

The Config facade should also be imported: 

use Config;

use Stripe\Customer;
use Stripe\Charge;
use Stripe\Invoice;
use Stripe\Plan;
use Stripe\Stripe;
use Stripe\Subscription;
use Stripe\Webhook;

Now we need to provide Stripe the API Secret key this will be used for all API calls, using a before() method means all methods of the class will have access to this. Retrieve the key by calling Config::get followed by stripe, then the item in this case apiSecretKey. 

public function before()

That’s it Nova is now ready to start making API calls with Stripe. 

Domains are often purchased from multiple providers, keeping track of where a domain is and its DNS settings can be tricky. Domain Mapper solves this by listing all your domains in one place. View your DNS settings and receive reminders to renew your domains. Try it today.

Support my work by donating with PayPal.

Subscribe to my newsletter

Subscribe and get my books and product announcements.

© 2009 - 2021 DC Blog. All code MIT license. All rights reserved.