I have downloaded the Stripe NuGet package for processing payments.
I've seen a number of places in the documentation that talk about an API v2, but if I use Visual Studio to show the source code using metadata, I see references to paths like "/v1/billing/meter_events". Obviously, I'm currently using version 1.
How does one use this library to access the version 2 API?
I have downloaded the Stripe NuGet package for processing payments.
I've seen a number of places in the documentation that talk about an API v2, but if I use Visual Studio to show the source code using metadata, I see references to paths like "/v1/billing/meter_events". Obviously, I'm currently using version 1.
How does one use this library to access the version 2 API?
Share Improve this question asked Nov 19, 2024 at 1:49 Jonathan WoodJonathan Wood 67.5k82 gold badges305 silver badges533 bronze badges1 Answer
Reset to default 1The API v2 will use a different path, and different namespaces in the SDK. See Stripe Doc. For example:
StripeClient stripe = new StripeClient("{{YOUR__API_KEY}}");
# Call a v2 API
var event = stripe.V2.Core.Events.Retrieve("evt_123");
# Call a v1 API
var customer = stripe.V1.Customers.Retrieve("cus_123");
Now specifically looking at the meter Event, again, on Stripe Doc about V2 Meter Event you have this line of code example, which indicates how to use V2 API:
client.V2.Billing.MeterEventStream.Create(options);