Giter Site home page Giter Site logo

nova-stripe-checkout-field's Introduction

A Stripe Checkout Button for Laravel Nova

This package contains a Nova field to add Stripe Checkout buttons to your forms & actions.

screenshot of the Stripe Checkout Button field

Requirements

This field requires a Stripe API Key to work.

Installation

Install this package in your Laravel app via composer:

composer require depsimon/nova-stripe-checkout-field

Usage

You can use this field in your forms and in your actions. Here's how I use it in a PublishJob action that requires a Stripe Token.

\\ app\Nova\Actions\PublishJob.php
\\ use Depsimon\NovaStripeCheckoutField\NovaStripeCheckoutField;

public function fields()
{
    return [
        NovaStripeCheckoutField::make('Regular', 'regular_token')
            ->amount(9999)
            ->currency('eur')
            ->company('Nova Jobs')
            ->description('Regular Job Posting for 60 days')
            ->label('Checkout Regular Posting for 99€'),

        NovaStripeCheckoutField::make('Premium', 'premium_token')
            ->amount(19999)
            ->currency('eur')
            ->company('Nova Jobs')
            ->description('Premium Job Posting for 60 days')
            ->label('Checkout Premium Posting for 129€'),
    ];
}

The field will automatically get the Stripe API key from the 'services.stripe.key' config, but you can override it by using the key($key) method on the field.

You can also set the amount (amount($amount)), currency (currency($currency)), locale (locale($locale)), company name (company($company)), image (image($image)), product description (description($description)), checkout button label (label($label)), cancel button label (cancelLabel($cancelLabel)).

The Stripe Token for the Checkout will be available in the field with the name you chose. In my case, it will be regular_token or premium_token.

screenshot of the Stripe Checkout Button field in action screenshot of the Stripe Checkout Button field in action

Credits

License

The MIT License (MIT).

nova-stripe-checkout-field's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

nova-stripe-checkout-field's Issues

Nova 4.0 support?

I have specified the key as my pk_test key because the instructions don't stipulate which key to use. But I am currently getting an error whenever I invoke the action:

TypeError: Cannot read properties of undefined (reading '_c')

Maybe this is just a Nova 4.0 support issue?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.