{"id":22004782,"url":"https://github.com/expdev07/laravel-cashier-stripe-connect","last_synced_at":"2025-04-09T09:07:50.220Z","repository":{"id":39926252,"uuid":"317634348","full_name":"ExpDev07/laravel-cashier-stripe-connect","owner":"ExpDev07","description":"💲 Adds Stripe Connect functionality to Laravel's main billing package, Cashier. Simply works as a drop-in on top of Cashier, with no extra configuration.","archived":false,"fork":false,"pushed_at":"2022-11-01T13:23:46.000Z","size":57,"stargazers_count":62,"open_issues_count":3,"forks_count":27,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-04-02T06:09:05.227Z","etag":null,"topics":["cashier","laravel","laravel-cashier","package","stripe","stripe-connect"],"latest_commit_sha":null,"homepage":"https://github.com/ExpDev07/laravel-cashier-stripe-connect","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ExpDev07.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-01T18:38:10.000Z","updated_at":"2025-02-18T07:02:06.000Z","dependencies_parsed_at":"2022-09-22T14:41:19.253Z","dependency_job_id":null,"html_url":"https://github.com/ExpDev07/laravel-cashier-stripe-connect","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ExpDev07%2Flaravel-cashier-stripe-connect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ExpDev07%2Flaravel-cashier-stripe-connect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ExpDev07%2Flaravel-cashier-stripe-connect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ExpDev07%2Flaravel-cashier-stripe-connect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ExpDev07","download_url":"https://codeload.github.com/ExpDev07/laravel-cashier-stripe-connect/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248008630,"owners_count":21032556,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cashier","laravel","laravel-cashier","package","stripe","stripe-connect"],"created_at":"2024-11-30T00:17:12.247Z","updated_at":"2025-04-09T09:07:50.199Z","avatar_url":"https://github.com/ExpDev07.png","language":"PHP","funding_links":["https://ko-fi.com/C1C510DUQ'"],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=center\u003e\r\n\tlaravel-cashier-stripe-connect\r\n\u003c/h1\u003e\r\n \r\n\u003cp align=\"center\"\u003e\r\n\t\u003ca href=\"https://packagist.org/packages/expdev07/laravel-cashier-stripe-connect\"\u003e\u003cimg src=\"https://img.shields.io/packagist/dt/expdev07/laravel-cashier-stripe-connect\" alt=\"Total Downloads\"\u003e\u003c/a\u003e\r\n\t\u003ca href=\"https://packagist.org/packages/expdev07/laravel-cashier-stripe-connect\"\u003e\u003cimg src=\"https://img.shields.io/packagist/v/expdev07/laravel-cashier-stripe-connect\" alt=\"Latest Stable Version\"\u003e\u003c/a\u003e\r\n\t\u003ca href=\"https://packagist.org/packages/expdev07/laravel-cashier-stripe-connect\"\u003e\u003cimg src=\"https://img.shields.io/packagist/l/expdev07/laravel-cashier-stripe-connect\" alt=\"License\"\u003e\u003c/a\u003e\r\n\u003c/p\u003e\r\n\r\n\u003e ## Newer Package Available\r\n\u003e A more comprehensive package is now available, built upon this package so can be upgraded to from this package, it offers multi-model, multi-tenancy support, UUID support and the following features:\r\n\u003e * Multi Model support - Previously only supported the User model, now any model can have the Connect Billable trait added to it and immediately inherit functionality.\r\n\u003e * Tenancy for Laravel Support (Multi Tenant SaaS Plugin)\r\n\u003e * Manage connected account onboarding\r\n\u003e * Direct Charges\r\n\u003e * Destination Charges\r\n\u003e * Connected account customer management (Direct Customers)\r\n\u003e * Connected account payment method management\r\n\u003e * Connected account subscriptions ( Direct Subscriptions )\r\n\u003e * Connected account product \u0026 price management\r\n\u003e * Connect Webhook Support (On behalf of connected accounts)\r\n\u003e * Connected Account Apple Pay Domain Registering\r\n\u003e  \r\n\u003e ### [Click here to access the new package](https://github.com/l4nos/laravel-cashier-stripe-connect)\r\n\u003e As a result of the new package, this package will no longer be maintained.\r\n\r\n\u003cp\u003e\r\n    \u003ca href='https://ko-fi.com/C1C510DUQ' target='_blank'\u003e\r\n\t\u003cimg height='36' style='border:0px;height:36px;' src='https://az743702.vo.msecnd.net/cdn/kofi3.png?v=2' border='0' alt='Buy Me a Coffee at ko-fi.com' /\u003e\r\n    \u003c/a\u003e\r\n\u003c/p\u003e\r\n\r\n\u003e 💲 Adds Stripe Connect functionality to Laravel's main billing package, Cashier. Simply works as a drop-in on top of Cashier, with no extra configuration.\r\n\r\n## Installation\r\n\r\n1. Enable Stripe Connect in your [dashboard settings](https://dashboard.stripe.com/settings).\r\n2. Install Cashier: ``composer require laravel/cashier``.\r\n3. Install package: ``composer require expdev07/laravel-cashier-stripe-connect``.\r\n4. Run migrations: ``php artisan migrate``.\r\n5. Configure Stripe keys for Cashier: [Cashier Docs](https://laravel.com/docs/9.x/billing#api-keys).\r\n\r\n**Note:** the package will not work as intended if you do not install [Laravel's official Cashier package](https://laravel.com/docs/8.x/billing) first.\r\n\r\n## Use\r\n\r\nThe library builds on the official [Cashier](https://laravel.com/docs/8.x/billing) library, so getting up and started is a breeze.\r\n\r\n### Setup model\r\n\r\nAdd the ``Billable`` traits to your model. You can use them individually or together. You can also create your own ``Billable`` trait and put them together there. In \r\naddition, the model should also implement the ``StripeAccount`` interface.\r\n\r\n```php\r\nnamespace App\\Models;\r\n\r\nuse Illuminate\\Foundation\\Auth\\User as Authenticatable;\r\nuse ExpDev07\\CashierConnect\\Contracts\\StripeAccount;\r\nuse Laravel\\Cashier\\Billable as CashierBillable;\r\nuse ExpDev07\\CashierConnect\\Billable as ConnectBillable;\r\n\r\nclass User extends Authenticatable implements StripeAccount\r\n{\r\n    use CashierBillable;\r\n    use ConnectBillable;\r\n\r\n    ///\r\n\r\n}\r\n```\r\n\r\n### Create controller\r\n\r\nCreate a controller to manage on-boarding process. The example below registers an Express account for the user.\r\n\r\n```php\r\nnamespace App\\Http\\Controllers;\r\n\r\nuse App\\Http\\Controllers\\Controller;\r\nuse App\\Models\\User;\r\nuse Illuminate\\Http\\RedirectResponse;\r\nuse Illuminate\\Http\\Request;\r\nuse URL;\r\n\r\nclass StripeController extends Controller\r\n{\r\n\r\n    /**\r\n     * Creates an onboarding link and redirects the user there.\r\n     *\r\n     * @param Request $request\r\n     * @return RedirectResponse\r\n     */\r\n    public function board(Request $request): RedirectResponse\r\n    {\r\n        return $this-\u003ehandleBoardingRedirect($request-\u003euser());\r\n    }\r\n\r\n    /**\r\n     * Handles returning from completing the onboarding process.\r\n     *\r\n     * @param Request $request\r\n     * @return RedirectResponse\r\n     */\r\n    public function returning(Request $request): RedirectResponse\r\n    {\r\n        return $this-\u003ehandleBoardingRedirect($request-\u003euser());\r\n    }\r\n\r\n    /**\r\n     * Handles refreshing of onboarding process.\r\n     *\r\n     * @param Request $request\r\n     * @return RedirectResponse\r\n     */\r\n    public function refresh(Request $request): RedirectResponse\r\n    {\r\n        return $this-\u003ehandleBoardingRedirect($request-\u003euser());\r\n    }\r\n\r\n    /**\r\n     * Handles the redirection logic of Stripe onboarding for the given user. Will \r\n     * create account and redirect user to onboarding process or redirect to account \r\n     * dashboard if they have already completed the process.\r\n     *\r\n     * @param User $user\r\n     * @return RedirectResponse\r\n     */\r\n    private function handleBoardingRedirect(User $user): RedirectResponse\r\n    {\r\n        // Redirect to dashboard if onboarding is already completed.\r\n        if ($user-\u003ehasStripeAccountId() \u0026\u0026 $user-\u003ehasCompletedOnboarding()) {\r\n            return $user-\u003eredirectToAccountDashboard();\r\n        }\r\n\r\n        // Delete account if already exists and create new express account with \r\n        // weekly payouts.\r\n        $user-\u003edeleteAndCreateStripeAccount('express', [\r\n            'settings' =\u003e [\r\n                'payouts' =\u003e [ \r\n                    'schedule' =\u003e [ \r\n                        'interval' =\u003e 'weekly', \r\n                        'weekly_anchor' =\u003e 'friday',\r\n                    ]\r\n                ]\r\n            ]\r\n        ]);\r\n\r\n        // Redirect to Stripe account onboarding, with return and refresh url, otherwise.\r\n        return $user-\u003eredirectToAccountOnboarding(\r\n            URL::to('/api/stripe/return?api_token=' . $user-\u003eapi_token),\r\n            URL::to('/api/stripe/refresh?api_token=' . $user-\u003eapi_token)\r\n        );\r\n    }\r\n\r\n}\r\n```\r\n\r\n## Example\r\n\r\n```php\r\n// Get user. This user has added the Billable trait and implements StripeAccount.\r\n$user = User::query()-\u003efind(1);\r\n\r\n// Transfer 10 USD to the user.\r\n$user-\u003etransferToStripeAccount(1000);\r\n\r\n// Payout 5 dollars to the user's bank account, which will arrive in 1 week.\r\n$user-\u003epayoutStripeAccount(500, Date::now()-\u003eaddWeek());\r\n\r\n```\r\n\r\n## License\r\n\r\nPlease refer to [LICENSE.md](https://github.com/ExpDev07/laravel-cashier-stripe-connect/blob/main/LICENSE) for this project's license.\r\n\r\n## Contributors\r\n\r\nThis list only contains some of the most notable contributors. For the full list, refer to [GitHub's contributors graph](https://github.com/ExpDev07/laravel-cashier-stripe-connect/graphs/contributors).\r\n* ExpDev07 (Marius) - creator and maintainer.\r\n* Haytam Bakouane [(hbakouane)](https://github.com/hbakouane) - contributor.\r\n\r\n## Thanks to\r\n\r\n[Taylor Otwell](https://twitter.com/taylorotwell) for his amazing framework and [all the contributors of Cashier](https://github.com/laravel/cashier-stripe/graphs/contributors).\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexpdev07%2Flaravel-cashier-stripe-connect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexpdev07%2Flaravel-cashier-stripe-connect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexpdev07%2Flaravel-cashier-stripe-connect/lists"}