#_kitem
1 messages ยท Page 1 of 1 (latest)
hi there!
can you share the request ID (req_xxx)? you can find it here https://dashboard.stripe.com/test/logs
the error message should contain the requestb ID in thhis field: https://stripe.com/docs/api/errors#errors-request_log_url
I'm printing all the error message from the catch
but that is all I have
let's me investiagte
also I would recommend to update your stripe-php version to the latest version.
using the code to print out all the catches
got the sameissue
(Status 404) Unrecognized request URL (POST: /v1/subscription_items//usage_records). If you are trying to list objects, remove the trailing slash. If you are trying to retrieve an object, make sure you passed a valid (non-empty) identifier in your code. Please see https://stripe.com/docs or we can help at https://support.stripe.com/.
Find help and support for Stripe. Our support site provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
the strange thing is that it adds two slashes to the call
but actually I am using the Stripe libarry, don't understand from where is coming the secondo slash
which version of stripe-php are you using?
7.0.2 I think
seeing the code
but it was working some time before
now just debugging why it stops works
and found that double slashes
but we haven't updated the library on the code
something must have changed
is the issue only with usage record? or with all Stripe endpoints?
could you try upgrading to the latest version of stripe-phpe?
it is only with that endpoint
the other things are working as expected
it could be an issue upgrade the library
just for this one thing :/
can you share your account ID (acct_xxx)? it's at the top of this page: https://dashboard.stripe.com/settings/account
thanks! give me a few minutes to look into this.
sure I am here, thanks
was the issue in test mode or live mode?
test mode
but live mode seems it not works, for this I was investigating
but we've found that because some customers are not paying some things, so I was just investigating and got that log error about the double slash
thanks, looking into this
๐ taking over for my colleague.
hello, thank you ๐
would you mind logging $subscriptionItemId?
let me check
I'm suspecting that the ID is empty space or null
it make sense
let me check
seems it is not empty, it's value is si_PQBUNeEpj4irXu
but passing it forced into the function has hardcoded it seems it find it and returns another error (maybe due to test settings wrong on my side)
(Status 400) (Request req_WsX3PVhmfMqzZV) Cannot create a usage record with usage type licensed. You can only create a usage record for metered plans.
var_dump($subscriptionItemId);
try {
$stripe->subscriptionItems->createUsageRecord(
$subscriptionItemId,
[
'quantity' => $usage,
'timestamp' => $currentTimestamp,
]
);
from this code I got this error
object(stdClass)#64 (1) {
["plan"]=>
string(17) "si_PQBUNeEpj4irXu"
}
(Status 404) Unrecognized request URL (POST: /v1/subscription_items//usage_records). If you are trying to list objects, remove the trailing slash. If you are trying to retrieve an object, make sure you passed a valid (non-empty) identifier in your code. Please see https://stripe.com/docs or we can help at https://support.stripe.com/.
Find help and support for Stripe. Our support site provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
ok so there are 2 issues here
let's try to handle them one by one
so basically the error is that you're passing an object where instead the createUsageRecord needs the string
so basically in order for your current code to work
ohhh you're right
$$subscriptionItemId needs to be $subscriptionItemId->plan
the second issue is basically regarding the price on which you're applying the usage record
which is price_1O0PSNE9n8wrXE2irb8T7ThA
that is not a metered price
ok, please just to check
is this product in production metered? prod_OqIGLnes9gzXyx
it's not the product
oh ok
but rather the price that can be licensed or metered
the product is just a way to describe what you're selling
which can have multiple prices
ok, our use case is to send all the cosumption of the period when the upcoming is coming to our webhook
and for this we add the usage through that createUsageRecord
so where I can check if it is metered or not? and from where I can set it?
you can look at the price object
just paste the price ID I shared in your dashboard
and it will give you all the details
or you can retrieve the price by ID and you can check its values
I does not find it into the dashboard into the test mode and neither into production mode
found rightnow
ok but wait
that is monthly, buty actually the user has other prices into the subscription
that should be updated with consumption
let me send you it
sub_1ObL7LE9n8wrXE2iFQ2QHByk
this contains si_PQBU0ZSPPYWhmN si_PQBUnwA7Ycs8y4 si_PQBUZJCFfSn8aV
that should be metered and updated, are they correct?
because maybe we are just pointing on the wrong value for some reason, need to investiagte
you need to pass in the subscription item that is metered
not any subscription item
a subscription can have multiple Subscription Items that are related to metered prices
this is why you need to specify which one is the one you're creating usage record for
okok
exactly
I'll check it
you're pointing to the wrong subscription item
okok
thank you for your time
let me investigate and in case I've some doubt I'll come back to you