简体   繁体   English

如何使用Authorize.Net API更新SubscriptionRequest调用的发票编号?

[英]How do I update the invoice number of a SubscriptionRequest call using the Authorize.Net API?

Okay so here's my issue. 好的,这是我的问题。 I'm trying to build a recurring payment service for a product I'm building. 我正在尝试为我要构建的产品构建定期付款服务。 I'm using Authorize.Net right now to build this. 我现在正在使用Authorize.Net来构建它。 I downloaded their source code and API and plugged it into my code behind file. 我下载了他们的源代码和API,并将其插入到文件背后的代码中。

Here's what my code looks like right now: 这是我的代码现在的样子:

try
{
     // create the address
     var address = new Address
     {
         Street = "123 4th Street",
         City = "Awesome City",
         State = "MD",
         Zip = "12345",
         Country = "US",
         Company = "Doe's Company",
         First = "John",
         Last = "Doe",
         ID = new Guid().ToString(),
         Phone = "(123) 456-7890"
    };

    // create the request
    SubscriptionRequest request =
    SubscriptionRequest.CreateMonthly("john@doe.com", "Test Subscription", 10.00M)
        .UsingCreditCard("John", "Doe", "4007000000027", 2020, 12)
        .WithBillingAddress(address);
    // create the gateway, sending in your credentials
    var gate = new SubscriptionGateway(ConfigurationManager.AppSettings["apiloginid"],                                     ConfigurationManager.AppSettings["transactionkey"], ServiceMode.Test);
    // make some money
    ISubscriptionRequest response = gate.CreateSubscription(request);
    return Json(response.SubscriptionID);
}
catch (Exception ex)
{
    return Json(ex.Message);
}

Every time I call this, I get an error saying: 每次我打电话时,我都会收到一条错误消息:

Error processing request: E00012 - You have submitted a duplicate of Subscription 1983944. A duplicate subscription will not be created. 错误处理请求:E00012-您提交了订阅1983944的副本。将不会创建重复的订阅。

I looked it up and found that I need to update the Invoice Number whenever I want to submit a new subscription. 我查了一下,发现我想提交新的订阅时都需要更新发票编号。 Using the SubscriptionRequest, I can't seem to do that. 使用SubscriptionRequest,我似乎无法做到这一点。

Does anyone know how I can go about updating the Invoice Number using this method? 有谁知道我可以使用这种方法更新发票编号吗?

I solved the issue by loading the source code into my project and manually changing the code so that an invoice number was generated each time. 我通过将源代码加载到项目中并手动更改代码来解决此问题,以便每次生成发票编号。

I wish they would update their API to do this though. 我希望他们能更新他们的API来做到这一点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM