diff --git a/README.md b/README.md index d203b24e..ec542872 100644 --- a/README.md +++ b/README.md @@ -331,6 +331,10 @@ To cancel a subscription, call the `cancel` method on the user's subscription: ```php $user->subscription('main')->cancel(); ``` +or +```php +$user->subscription('main')->cancelAt(now()); +``` When a subscription is cancelled, Cashier will automatically set the `ends_at` column in your database. This column is used to know when the `subscribed` method should begin returning `false`. For example, if a customer cancels a subscription on March 1st, but the subscription was not scheduled to end until March 5th, the `subscribed` method will continue to return `true` until March 5th. @@ -460,6 +464,29 @@ $invoice->download(); // get a download response for the pdf To list invoices, access the user's orders using: `$user->orders->invoices()`. This includes invoices for all orders, even unprocessed or failed orders. +For list of invoices + +```php + +``` +and add this route inside web.php + +```php +Route::middleware('auth')->get('/download-invoice/{orderId}', function($orderId){ + + return (request()->user()->downloadInvoice($orderId)); +}); +``` + ### Refunding Charges Coming soon. @@ -478,7 +505,7 @@ __Use these with care:__ ```php $credit = $user->credit('EUR'); -$user->addCredit(new Amount(10, 'EUR'); // add €10.00 +$user->addCredit(new Amount(10, 'EUR')); // add €10.00 $user->hasCredit('EUR'); ``` diff --git a/src/Helpers/helpers.php b/src/Helpers/helpers.php index 33826c64..c04c078c 100644 --- a/src/Helpers/helpers.php +++ b/src/Helpers/helpers.php @@ -32,7 +32,7 @@ function object_to_array_recursive($object) */ function money(int $value, string $currency) { - return new Money($value, new \Money\Currency($currency)); + return new Money($value, new Currency($currency)); } } @@ -48,7 +48,7 @@ function decimal_to_money(string $value, string $currency) { $moneyParser = new DecimalMoneyParser(new ISOCurrencies()); - return $moneyParser->parse($value, $currency); + return $moneyParser->parse($value, new Currency($currency)); } }