Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

handy_man's avatar

Adding credit to a users stripe account?

Is there anyway in cashier to add credit to a users stripe account? I don't currently see anything that indicates I can add credit to their account. This functionality exists in the stripe dashboard, but I'm definitely not going to process these things manually :P

Variety of applications for this but mine revolves around giving users credit based on a referral.

Many thanks :)

0 likes
3 replies
carlcassar's avatar

You will need to apply an existing coupon by swapping the user's subscription:

$user->subscription('monthly')
     ->withCoupon('code')
     ->swap();
handy_man's avatar
handy_man
OP
Best Answer
Level 2

@carlcassar That wouldn't work because it's for the use case of a referral, if they got two in one month it would be as if he only got 1.

Either way I figured this out with the following:

use Stripe\Customer as StripeAccount;


                            $customer= StripeAccount::retrieve($user->stripe_id);
                            $customer->account_balance = $customer->account_balance + -100;
                            $customer->save();

Quite simple to understand that I use the Stripe-php package (the same as Cashier) but just go direct with an API request to update the users details. Example of what you can update here: https://stripe.com/docs/api/php#update_customer

Why this functionality isn't inside of Cashier I don't really know, but no matter easy enough to implement.

jekinney's avatar

Cashier is just a simple wrapper and out of the box seems to only do half of what stripes API does. I guess it's mainly to get people up and running quickly and use stripes site too, geared for subscription (sas apps).

I dumped cashier awhile ago as I seemed to always extend cashier anyways. Mainly setting up my apps back end to make subscriptions, coupons etc with out ever needed to touch stripes site.

1 like

Please or to participate in this conversation.