Code Monkey home page Code Monkey logo

checkout's Introduction

Build Status MIT License

Checkout

This package provides API endpoints and common functionality for cart, checkout, orders and coupons. You can use it with your own UI or use Checkout Vue package that works with this API out of the box.

Installation

You can install this package via composer:

composer require 64robots/checkout

Once installed, this package will automatically register its service provider.

You can publish the package migrations with:

php artisan vendor:publish --provider="R64\Checkout\CheckoutServiceProvider" --tag="migrations"

After the migrations have been published, you can create package tables with:

php artisan migrate

By running migrations, these tables will be created:

  • customers
  • products
  • cart
  • cart_items
  • orders
  • order_items
  • coupons
  • order_purchases

You can also publish the package config with:

php artisan vendor:publish --provider="R64\Checkout\CheckoutServiceProvider" --tag="config"

After the config has been published, you can find it's contents in config/checkout.php

return [

    /*
     * Required parameters when submitting an order to /api/orders endpoint
     */
    'required' => [
        'customer_email',
        'shipping_first_name',
        'shipping_last_name',
        'shipping_address_line1',
        // 'shipping_address_line2',
        'shipping_address_city',
        'shipping_address_region',
        'shipping_address_zipcode',
        'shipping_address_phone',
        'billing_first_name',
        'billing_last_name',
        'billing_address_line1',
         // 'billing_address_line2',
        'billing_address_city',
        'billing_address_region',
        'billing_address_zipcode',
        'billing_address_phone',
    ],

    /*
     * Terms and conditions url used usually in the checkout UI
     */
    'toc_url' => '#',

    /*
     * Currency code that will be saved with every order and symbol
     * that is usually used in the Cart, Checkout and Order UI
     */
    'currency' => [
        'code' => env('CHECKOUT_CURRENCY_CODE', 'USD'),
        'symbol' => env('CHECKOUT_CURRENCY_SYMBOL', '$')
    ],

    /*
     * Percentage of Cart total and fixed fee will be stored for every
     * order purchase (transaction)
     */
    'stripe' => [
        'percentage_fee' => env('CHECKOUT_STRIPE_PERCENTAGE_FEE', 29 / 1000),
        'fixed_fee' => env('CHECKOUT_STRIPE_FIXED_FEE', 30)
    ],

    /*
     * Shipping city and state is automatically resolved from zip code
     * using GeoNames service http://www.geonames.org/
     *
     * Country code constraints the search results
     * to specific country
     */
    'geo_names' => [
        'username' => env('CHECKOUT_GEO_NAMES_USERNAME', 'demo'),
        'country_code' => env('CHECKOUT_GEO_NAMES_COUNTRY_CODE', 'US')
    ],

    /*
     * Class names can be replaced and extended with your own logic
     */
    'product_model' => R64\Checkout\Models\Product::class,
    'customer_model' => R64\Checkout\Models\Customer::class,
    'cart_model' => R64\Checkout\Models\Cart::class,
    'cart_item_model' => R64\Checkout\Models\CartItem::class,
    'coupon_model' => R64\Checkout\Models\Coupon::class,
    'order_model' => R64\Checkout\Models\Order::class,
    'order_item_model' => R64\Checkout\Models\OrderItem::class,
    'product_resource' => R64\Checkout\Http\Resources\ProductResource::class,
    'payment' => R64\Checkout\StripePaymentHandler::class
];

Nova

You can publish nova resources with:

php artisan vendor:publish --provider="R64\Checkout\CheckoutServiceProvider" --tag="nova"

Available API Endpoints

Once you install the package and run migrations, these API endpoints will be available in your application.

API Docs

Licence

Checkout is open-source software licensed under the MIT license

checkout's People

Contributors

lacasera avatar michalgallovic avatar mmanzano avatar simoebenhida avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

checkout's Issues

Suport for Laravel 9.x

Overview:

We are currently upgrading our project to PHP 8.1 and Laravel 9.x. We have upgraded PHP to 8.1 and began work on upgrading from Laravel Framework 8.83.27 to Laravel Framework 9.x. One of the first issues we ran into when upgrading is the package 64robots/checkout is not compatible with Larvel 9.x and is capped at Laravel 8.x. Is it possible to upgrade this project to be compatible with newer versions of Laravel?

This is a major blocker for us.

Composer file (composer.json)

...
"require": {
        "php": "^8.1",
        "64robots/checkout": "^2.0",
...

Steps to Reproduce:

  1. With an existing Larvavel project based on version 8.x follow the steps outlined to upgrade the project to 9.x here.
  2. Once the composer.json is updated per the above upgrade steps run the command someone@local % composer update

Expected Result:
Composer updates the packages including the package 64robots/checkout unblocking the upgrade.

Actual Result
The package update fails with the following message.

someone@local % composer update && composer install
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - 64robots/checkout[2.0, ..., 2.0.x-dev] require laravel/framework ^8.0 -> found laravel/framework[v8.0.0, ..., 8.x-dev] but it conflicts with your root composer.json require (^9.0).
    - Root composer.json requires 64robots/checkout ^2.0 -> satisfiable by 64robots/checkout[2.0, 2.0.x-dev].

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.