64robots / stripe
A package to add stripe integration 64 robots packages
Installs: 6 805
Dependents: 1
Suggesters: 0
Security: 0
Stars: 5
Watchers: 3
Forks: 1
Open Issues: 0
pkg:composer/64robots/stripe
Requires
- php: ^7.1
- fzaninotto/faker: ^1.4
- illuminate/container: ^5.0|^6.0|^7.0
- illuminate/support: ^5.0|^6.0|^7.0
- stripe/stripe-php: ^7.27
Requires (Dev)
- mockery/mockery: ^1.0
- orchestra/testbench: ^4.0
- phpunit/phpunit: ^8.0
- dev-master
- 1.11.0
- v1.1.8
- v1.1.7
- v1.1.6
- v1.1.5
- v1.1.4
- v1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.10
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- dev-support-laravel-11-and-12
- dev-feature/balance-and-payout
- dev-feature/add-latest-invoice-to-subscription
- dev-feature/add-create-connect-charge
- dev-refactor-mockhandler
- dev-feature/add-reference-to-stripe-subscription-object
- dev-feature/add-reference-to-stripe-charge-object
This package is auto-updated.
Last update: 2025-10-24 12:42:52 UTC
README
This package makes it easier to add stripe integrations to laravel applications
Installation and setup
To get the latest version, simply require the package using Composer:
$ composer require 64robots/stripe
Once installed, this package will automatically register its service provider.
To publish the config file to config/stripe.php run:
$ php artisan vendor:publish --provider="R64\Stripe\StripeServiceProvider" --tag="config"
Usage
The class you'd propably interact with the most is PaymentProcessor class. The processor class can be injected into other classes or can be resolved from the container.
use R64\Stripe\PaymentProcessor;
.
.
.
$processor = app(PaymentProcessor::class);
$charge = $processor->createCharge([
    'customer' => 'cus_GVIiC06JWCq1mo',
    'amount' => 100,
    'currency' => 'USD',
    'source' => 'tok_visa'
]);
Charges
- To charge a credit or a debit card, you create a Charge object. You can create a charge using the createChargemethod on thePaymentProcessorclass. AR64\Stripe\Objects\Chargeobject would be returned.
$charge = $processor->createCharge([
    'customer' => 'cus_GVIiC06JWCq1mo',
    'amount' => 100,
    'currency' => 'USD',
    'source' => 'tok_visa'
]);
Customers
The processor allows you to create, update, list customers and get a single customer.
- To create a customer, use the createCustomermethod on the processor. AR64\Stripe\Objects\Customerobject would be returned.
$customer = $processor->createCustomer([
    'description' => 'Customer for jenny.rosen@example.com',
    'source' => 'tok_visa',
    'email' => jenny.rosen@example.com,
    'metadata' => [
        'first_name' => Rosen,
        'last_name' => Gina,
    ]
]);
- To update a customer, use the updateCustomermethod on the processor. AR64\Stripe\Objects\Customerobject would be returned.
$customer = $processor->updateCustomer([
    'id' => 1,
    'email' => jenny.rosen@example.com,
    'description' => Update jenny.rosen@example.com details,
    'source' => 'tok_visa'
]);
- To get a single customer, use the getCustomermethod on the processor. AR64\Stripe\Objects\Customerobject would be returned.
$customer = $processor->getCustomer('cus_GVIiC06JWCq1mo');
Card
You can get a card, create and update a card using the processor.
- To get a single card details, use the getCardmethod on the processor. AR64\Stripe\Objects\Cardobject would be returned.
$card = $processor->getCard('cus_GVIiC06JWCq1mo', 'card_1FyI6w2eZvKYlo2COseWzZAo');
- To create a card, use the createCardmethod on the processor. AR64\Stripe\Objects\Cardobject would be returned.
$card = $processor->createCard([
    'source' => 'tok_visa'
]);
- To update a card, use the updateCardmethod on the processor. AR64\Stripe\Objects\Cardobject would be returned.
$card = $processor->updateCard(
    'cus_GVIiC06JWCq1mo',
    'card_1FyI6w2eZvKYlo2COseWzZAo',
    [
        'name' => 'Jenny Rosen'
    ]
);
Plan and Subscription
Plans define the base price, currency, and billing cycle for subscriptions.
- To create a product, use the createProductmethod on the processor. AR64\Stripe\Objects\Productobject would be returned.
$product = $processor->createProduct([
    'name' => 'Monthly membership base fee',
    'type' => 'service',
]);
- To create a plan, use the createPlanmethod on the processor. AR64\Stripe\Objects\Planobject would be returned.
$plan = $processor->createPlan([
    'product' => ['name' => 'Gold special'],
    'nickname' => 'special,
    'interval' => 'month',
    'billing_scheme' => 'per_unit',
    'amount' => 100,
    'currency' => 'usd'
]);
- To create a subscription, use the createSubscriptionmethod on the processor. AR64\Stripe\Objects\Subscriptionobject would be returned.
$subscription = $processor->createSubscription([
    'customer' => 'cus_GVIiC06JWCq1mo',
    'items' => [
        [
            'object' => 'list',
            'plan' => plan_GVIh1z2696UJyR
        ]
    ]
]);
- To create an invoice, use the createInvoicemethod on the processor. AR64\Stripe\Objects\Invoiceobject would be returned.
$invoice = $processor->createInvoice([
    'customer' => 'cus_GVIiC06JWCq1mo',
    'subscription' => 'sub_DUVhBH3LKxekhs',
]);
- To create an invoice item, use the createInvoiceItemmethod on the processor. AR64\Stripe\Objects\InvoiceItemobject would be returned.
$invoiceItem = $processor->createInvoiceItem([
    'customer' => 'cus_GVIiC06JWCq1mo',
    'subscription' => 'sub_DUVhBH3LKxekhs',
    'amount' => 100,
    'currency' => 'usd',
]);
- To get an invoice details, use the getInvoicemethod. AR64\Stripe\Objects\Invoiceobject would be returned.
$invoice = $this->processor->getInvoice('in_1FJSdj2eZvKYlo2CCyOhyNxj');
- To get a subscription details, use the getSubscriptionmethod. AR64\Stripe\Objects\Subscriptionobject would be returned.
$subscription = $this->processor->getSubscription(sub_DUVhBH3LKxekhs);
Card Holder
You can create, update and get a card holder's details.
- To create a card holder, use the createCardHoldermethod. AR64\Stripe\Objects\CardHolderobject would be returned.
$cardHolder = $processor->createCardHolder([
    'type' => 'individual',
    'name' => 'Jenny Rosen',
    'email' => 'jenny.rosen@example.com',
    'phone_number' => '+18888675309',
    'billing' => [
        'name' => 'Jenny Rosen',
        'address' => [
        'line1' => '1234 Main Street',
        'city' => 'San Francisco',
        'state' => 'CA',
        'country' => 'US',
        'postal_code' => '94111',
        ],
    ],
]);
- To update a card holders details, use the updateCardHoldermethod. AR64\Stripe\Objects\CardHolderobject would be returned.
$cardHolder = $processor->updateCardHolder([
    'ich_1Ccy6F2eZvKYlo2ClnIm9bs4',
    [
        'metadata' => [
            'order_id' => '6735'
        ]
    ]
])
- To retrieve a card holder, use the getCardHoldermethod. AR64\Stripe\Objects\CardHolderobject would be returned.
$cardHolder = $processor->getCardHolder('ich_1Ccy6F2eZvKYlo2ClnIm9bs4');