最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c# - Stripe version 2 API? - Stack Overflow

programmeradmin1浏览0评论

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 badges
Add a comment  | 

1 Answer 1

Reset to default 1

The 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);
发布评论

评论列表(0)

  1. 暂无评论