我是新来的条纹,并决定使用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);这就是我所要做的,让客户按月收费计划吗?取消这个计划..。
var customerService = new StripeCustomerService();
StripeSubscription subscription = customerService.CancelSubscription(*customerId*);这就是我要做的?在stripe.net页面上也有一个用于创建收费的部分,我不确定我是否需要对此做任何事情。
发布于 2013-09-24 16:49:53
是的,就是这样。根据过去的经验,你是否期待着更痛苦的事情?)
Stripe的设计非常容易使用,大多数可用的库(包括Stripe.net)都在努力维护它。
你不必做任何有指控的事。如果你需要为某件一次性的事情向顾客收费,比如一顶帽子,那就是收费。计划要照顾好自己。
发布于 2016-12-22 13:20:03
使用最新的Stripe,StripeCustomerService不再支持CancelSubscription方法。以下是取消客户订阅的一种方法:
var subscriptionService = new StripeSubscriptionService();
var subscriptions = subscriptionService.List(account.StripeCustomerId);
foreach (var subscription in subscriptions)
{
if (subscription.CanceledAt == null)
subscriptionService.Cancel(account.StripeCustomerId, subscription.Id);
}https://stackoverflow.com/questions/18794421
复制相似问题