向现有客户添加信用卡来源时出现问题

时间:2018-09-19 18:57:46

标签: c# stripe-payments

我尝试向现有客户添加新的信用卡,但出现此错误:

  

收到的未知参数:卡

我想出了如何使用2018-09-19 18:04:20.782 DEBUG 22625 --- [ask-scheduler-2] o.s.yarn.am.allocate.AbstractAllocator : completed container: container_1536919363436_0805_01_000002 with status=ContainerStatus: [ContainerId: container_1536919363436_0805_01_000002, State: COMPLETE, Diagnostics: Exception from container-launch. Container id: container_1536919363436_0805_01_000002 Exit code: 1 Stack trace: ExitCodeException exitCode=1: at org.apache.hadoop.util.Shell.runCommand(Shell.java:545) at org.apache.hadoop.util.Shell.run(Shell.java:456) at org.apache.hadoop.util.Shell$ShellCommandExecutor.execute(Shell.java:722) at org.apache.hadoop.yarn.server.nodemanager.DefaultContainerExecutor.launchContainer(DefaultContainerExecutor.java:211) at org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.ContainerLaunch.call(ContainerLaunch.java:302) at org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.ContainerLaunch.call(ContainerLaunch.java:82) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Container exited with a non-zero exit code 1 , ExitStatus: 1, ] 来获取卡指纹以验证卡是否已经存在,但是我一直试图将卡添加到客户中。

我的代码如下:

StripeTokenService

1 个答案:

答案 0 :(得分:0)

好的,我弄清楚了如何与我分享我的答案:

if (!CreditCardExists(stripeCustomer, stripeToken))
{ 
    var creditCardService = new StripeNet.StripeCardService();
    var creditCardOptions = new StripeNet.StripeCardCreateOptions { SourceToken = tokenId };

    var creditCard = creditCardService.Create(stripeCustomer.Id, creditCardOptions, new StripeNet.StripeRequestOptions { ApiKey = ConfigurationManager.AppSettings["StripeSecretKey"] });

    // The only way I found to get customer with all sources...
    stripeCustomer = customerService.Get(stripeCustomerWithAccount.Id, new StripeNet.StripeRequestOptions { ApiKey = ConfigurationManager.AppSettings["StripeSecretKey"] });
}