简体   繁体   中英

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. I downloaded their source code and API and plugged it into my code behind file.

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.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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