Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metered Billing does not support their new API #1709

Closed
timwrb opened this issue Aug 22, 2024 · 1 comment
Closed

Metered Billing does not support their new API #1709

timwrb opened this issue Aug 22, 2024 · 1 comment

Comments

@timwrb
Copy link

timwrb commented Aug 22, 2024

Cashier Stripe Version

15.0

Laravel Version

11.21.0

PHP Version

8.2

Database Driver & Version

No response

Description

When dealing with metered billing, either with recieving usage records or reporting usage to a metered subscription, stripe tells me this:

Error:
Cannot create a usage record for SUBSCRIPTION_ITEM because it is not on the legacy metered billing system. Call /v1/billing/meter_events instead.

Here are the docs:
https://docs.stripe.com/api/billing/meter-event/create

This code worked for me then:

$stripe = new StripeClient(config('services.stripe.secret'));
$stripe->billing->meterEvents->create([
'event_name' => 'EVENT_NAMEr',
'payload' => [
'value' => '1',
'stripe_customer_id' => $company_stripe_id,
],
'identifier' => 'identifier_123',
]);

Steps To Reproduce

$company->subscription('default')->reportUsageFor('PRICE_ID', 1);

@driesvints
Copy link
Member

There was an attempt here but was reverted because of failing tests. We'd still very much appreciate PR's for this with passing tests. #1698

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants