GithubHelp home page GithubHelp logo

stripe's Introduction

Laravel Logo

Install

composer require aamroni/stripe

Config Example

Collect your public and secret keys, and configure as necessary in config/payment.php

'stripe' => [
    'public'        => env('STRIPE_PUBLIC_KEY'),
    'secret'        => env('STRIPE_SECRET_KEY'),
    'redirect'      => [
        'success'   => 'http://localhost:8000/stripe/success',
        'cancel'    => 'http://localhost:8000/stripe/cancel'
    ],
    'currency'      => 'USD'
]

Checkout Example

<?php

use Aamroni\Stripe\Entities\CustomerEntity;
use Aamroni\Stripe\Entities\PurchaseEntity;
use Aamroni\Stripe\Facades\Stripe;
use Aamroni\Stripe\StripePaymentManager;

// @step01: Create a customer information
$customer = CustomerEntity::instance(
    name: 'James Wilson',
    email: '[email protected]',
    mobile: '+1 562-506-8893',
    street: '2812 Locust Court',
    city: 'Irvine',
    postal: '92614',
    state: 'California',
    country: 'US'
);

// @step02: Create a purchase information
$purchase = PurchaseEntity::instance(
    title: 'FoldSack No. 1 Backpack, Fits 15 Laptops',
    quantity: 1,
    regular: 109.95,
    offered: 99,
    currency: 'USD'
);

// @step03: Process the Stripe checkout
$stripe = Stripe::checkout($customer, $purchase);
// or
$stripe = StripePaymentManager::instance()->checkout($customer, $purchase);

dd($stripe);

Customer Example

<?php

use Aamroni\Stripe\Contracts\CustomerContract;

$instance = CustomerContract::instance();
$response = $instance->create(CustomerEntity: $customer); // Create a customer information
$response = $instance->delete(); // Delete a customer information
$response = $instance->record(); // Fetch all customer information
$response = $instance->record(id: $id); // Fetch a specific customer information

dd($response);

Purchase Example

<?php

use Aamroni\Stripe\Contracts\PurchaseContract;

$instance = PurchaseContract::instance();
$response = $instance->create(PurchaseEntity: $purchase); // Create a purchase information
$response = $instance->record(); // Fetch all purchase information
$response = $instance->record(id: $id); // Fetch a specific purchase information

dd($response);

stripe's People

Contributors

md-aamroni avatar

Stargazers

Nafis Reza avatar M A Aziz Siddiqi avatar Tahmeedul Islam avatar  avatar

Watchers

 avatar

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.