Cla*_*ith 9 c# asp.net asp.net-mvc-4 stripe-payments
我是条纹新手,决定使用stripe.net(https://github.com/jaymedavis/stripe.net).
我想做的是让客户按照每月向他们收费的计划.我还想让他们取消他们对该计划的订阅.这是stripe.net项目显示使用的代码.
StripeConfiguration.SetApiKey("[your api key here]");
var myCustomer = new StripeCustomerCreateOptions();
// set these properties if it makes you happy
myCustomer.Email = "pork@email.com";
myCustomer.Description = "Johnny Tenderloin (pork@email.com)";
// set these properties if using a card
myCustomer.CardNumber = "4242424242424242";
myCustomer.CardExpirationYear = "2012";
myCustomer.CardExpirationMonth = "10";
myCustomer.CardAddressCountry = "US";
myCustomer.PlanId = *planId*;
var customerService = new StripeCustomerService();
StripeCustomer stripeCustomer = customerService.Create(myCustomer);
Run Code Online (Sandbox Code Playgroud)
这是我必须做的就是让客户按照每月收费的计划吗?并取消计划......
var customerService = new StripeCustomerService();
StripeSubscription subscription = customerService.CancelSubscription(*customerId*);
Run Code Online (Sandbox Code Playgroud)
这就是我要做的全部吗?在stripe.net页面上还有一个用于创建费用的部分,我不确定是否必须对此进行任何操作.
是的,就是这样.根据过去的经验,您是否期待更痛苦的事情?;)
Stripe API的设计非常易于使用,大多数可用的库(包括Stripe.net)都在努力维护它.
您无需为收费做任何事情.如果您需要向客户收取一些一次性的费用,比如可能是帽子,这就是收费的目的.计划照顾好自己.
| 归档时间: |
|
| 查看次数: |
6043 次 |
| 最近记录: |