From 0f8182d262c6e675842ae13f598df59f7059ea28 Mon Sep 17 00:00:00 2001 From: Arthur Nassar <98289378+arthurnassar@users.noreply.github.com> Date: Tue, 9 Jul 2024 18:18:29 +0100 Subject: [PATCH] Update method to avoid clash with laravel cashier (#2) * Update method to avoid clash with laravel cashier Currently both billable and payable implement the same pay method. This can break applications that can have users that will receive and pay on the platform in case of affiliate links for example This is a breaking change * update readme --- readme.md | 4 ++-- src/Traits/Payable.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/readme.md b/readme.md index 6dc8acb..bdf6df8 100644 --- a/readme.md +++ b/readme.md @@ -87,10 +87,10 @@ Route::get('/connect', function () { })->middleware(['auth']); ``` -Once a user's Stripe account is all connected and active, you can start sending them payments: +Once a user's Stripe account is all connected and active, you can start creating transfers: ```php -auth()->user()->pay(10000, 'usd'); +auth()->user()->transfer(10000, 'usd'); ``` > [!NOTE] diff --git a/src/Traits/Payable.php b/src/Traits/Payable.php index 8d36ab9..d24571b 100644 --- a/src/Traits/Payable.php +++ b/src/Traits/Payable.php @@ -71,7 +71,7 @@ public function getStripeAccountLink(LinkType $type = LinkType::Onboarding): str return $link->url; } - public function pay($amount, $currency): Transfer + public function transfer($amount, $currency): Transfer { // TODO: capture this in the database, which may allow us to do a reversal later return static::$stripe->transfers->create([