使用Stripe Connect代表店主为客户收费?

时间:2014-09-06 13:36:02

标签: c# asp.net stripe-payments stripe.net

我正在使用ASP.NET进行开发,并且我使用了Stripe.NET dll,根据我将shopkeeper条带帐户与我链接并获得访问代码的文档。

现在我对我的客户感到困惑,他应该作为顾客添加到店主的条纹帐户中,或者只是他的帐户与我的Stripe帐户作为店主联系。

任何人都可以解释,它将如何运作?

var stripeService = new StripeChargeService(sellerStore.StripeMerchantAccessToken); //The token returned from the above method
var stripeChargeOption = new StripeChargeCreateOptions() { 
AmountInCents = amountInCents,
Currency = "usd", 
CustomerId = buyerPaymentInfo.StripeCustomerToken,
Description = "Locabal",
ApplicationFeeInCents = locabalsCut 
};
var response = stripeService.Create(stripeChargeOption);

buyerPaymentInfo.StripeCustomerToken将是访问代码,还是将在供应商帐户中注册的客户?

我想使用他的信用卡向客户收费

我们非常感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

根据我对Stripe API的理解,您应该在帐户中创建一个客户,并使用以" cus _"开头的客户ID。在收费。

如果您查看以下stripe.net讨论,您将看到如何创建客户并在您负责使用它。

https://github.com/jaymedavis/stripe.net/pull/43#issuecomment-30345043

//This is what we do to create a long-term customer in our system
//user is a user object unique to our system. We save it in our database
//stripeToken is what is generated by the Javascript on the page
var stripeService = new stripeCustomerService(ConfigurationManager.AppSettings["StripeSecret"]);
var stripeTokenOptions = new StripeCustomerCreateOptions { TokenId = stripeToken };
var response = stripeService.Create(stripeTokenOptions);

if (user.PaymentInfo == null)
{
    PaymentInfo paymentInfo = new PaymentInfo
    {
        StripeCustomerToken = response.Id
    };
    user.PaymentInfo = paymentInfo;
}
else
{
    user.PaymentInfo.StripeCustomerToken = response.Id;
}