EDIT Oct'2016: This is no longer correct. Please check @Vercoutere answer below. New method was introduced by Taylor in April 2016 - check commit https://github.com/laravel/cashier/commit/d7e9766e20a2fc772e88d24c39c40b331c6c68e6
I couldn't find the answer to this question myself, so I post it for future reference.
In order to use Laravel Cashier we have to add Billable
trait and BillableContract
to User
model. This way our User
model can now use methods found in Billable
trait. When you look into it, you will find methods like getCurrency()
, getCurrencyLocale()
and addCurrencySymbol($amount)
. Just copy these 3 methods from original trait, paste into your User
model and edit afterwards to apply your currency and locale.
For me (UK) it was:
/**
* Get the Stripe supported currency used by the entity.
*
* @return string
*/
public function getCurrency()
{
return 'gbp';
}
/**
* Get the locale for the currency used by the entity.
*
* @return string
*/
public function getCurrencyLocale()
{
return 'en_GB';
}
/**
* Add the currency symbol to a given amount.
*
* @param string $amount
* @return string
*/
public function addCurrencySymbol($amount)
{
return '£'.$amount;
}
You can read more about it on Alex Kaye's blog