(13) 商户登录ID或密码无效或账户无效 [英] (13) The merchant login ID or password is invalid or the account is inactive

查看:30
本文介绍了(13) 商户登录ID或密码无效或账户无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 asp.net 在我的网站中实现 Authorize .net 支付网关.我是这方面的初学者.有人可以给我一个示例代码,我可以从那里重定向到 Authorize.net 页面以完成付款过程.我已经创建了一个沙箱帐户.重定向 URL - https://test.authorize.net/gateway/transact.dll但我收到一个错误

I want to implement Authorize .net payment gateway in my website using asp.net. I am a beginner in this. Can someone give me a sample code from where I can be redirected to the Authorize.net page to complete payment process. I have created a sandbox account. Redirection URL - https://test.authorize.net/gateway/transact.dll but I get an error

(13) 商户登录ID或密码无效或账户无效.

(13) The merchant login ID or password is invalid or the account is inactive.

我的帐户处于活动状态并处于测试模式.

My account is active and in test mode.

我的代码:

protected void Button_pay_Click(object sender, EventArgs e)
    {
        string value = TextBox_amt.Text;
        decimal d = decimal.Parse(value);
        Run("abc", "abcq234", d);
     }
 public static ANetApiResponse Run(String ApiLoginID, String ApiTransactionKey, decimal amount)
    {
        Console.WriteLine("Create an Accept Payment Transaction Sample");

        ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = AuthorizeNet.Environment.SANDBOX;

        // define the merchant information (authentication / transaction id)
        ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = new merchantAuthenticationType()
        {
            name = ApiLoginID,
            ItemElementName = ItemChoiceType.transactionKey,
            Item = ApiTransactionKey,
        };

        var opaqueData = new opaqueDataType
        {
            dataDescriptor = "COMMON.ACCEPT.INAPP.PAYMENT",
            dataValue = "119eyJjb2RlIjoiNTBfMl8wNjAwMDUyN0JEODE4RjQxOUEyRjhGQkIxMkY0MzdGQjAxQUIwRTY2NjhFNEFCN0VENzE4NTUwMjlGRUU0M0JFMENERUIwQzM2M0ExOUEwMDAzNzlGRDNFMjBCODJEMDFCQjkyNEJDIiwidG9rZW4iOiI5NDkwMjMyMTAyOTQwOTk5NDA0NjAzIiwidiI6IjEuMSJ9"

        };

        var billingAddress = new customerAddressType
        {
            firstName = "John",
            lastName = "Doe",
            address = "123 My St",
            city = "OurTown",
            zip = "98004"
        };

        //standard api call to retrieve response
        var paymentType = new paymentType { Item = opaqueData };

        // Add line Items
        var lineItems = new lineItemType[2];
        lineItems[0] = new lineItemType { itemId = "1", name = "t-shirt", quantity = 2, unitPrice = new Decimal(15.00) };
        lineItems[1] = new lineItemType { itemId = "2", name = "snowboard", quantity = 1, unitPrice = new Decimal(450.00) };

        var transactionRequest = new transactionRequestType
        {
            transactionType = transactionTypeEnum.authCaptureTransaction.ToString(),    // charge the card

            amount = amount,
            payment = paymentType,
            billTo = billingAddress,
            lineItems = lineItems
        };

        var request = new createTransactionRequest { transactionRequest = transactionRequest };

        // instantiate the contoller that will call the service
        var controller = new createTransactionController(request);
        controller.Execute();

        // get the response from the service (errors contained if any)
        var response = controller.GetApiResponse();

        //validate
        if (response != null)
        {
            if (response.messages.resultCode == messageTypeEnum.Ok)
            {
                if (response.transactionResponse.messages != null)
                {
                    Console.WriteLine("Successfully created transaction with Transaction ID: " + response.transactionResponse.transId);
                    Console.WriteLine("Response Code: " + response.transactionResponse.responseCode);
                    Console.WriteLine("Message Code: " + response.transactionResponse.messages[0].code);
                    Console.WriteLine("Description: " + response.transactionResponse.messages[0].description);
                    Console.WriteLine("Success, Auth Code : " + response.transactionResponse.authCode);
                }
                else
                {
                    Console.WriteLine("Failed Transaction.");
                    if (response.transactionResponse.errors != null)
                    {
                        Console.WriteLine("Error Code: " + response.transactionResponse.errors[0].errorCode);
                        Console.WriteLine("Error message: " + response.transactionResponse.errors[0].errorText);
                    }
                }
            }
            else
            {
                Console.WriteLine("Failed Transaction.");
                if (response.transactionResponse != null && response.transactionResponse.errors != null)
                {
                    Console.WriteLine("Error Code: " + response.transactionResponse.errors[0].errorCode);
                    Console.WriteLine("Error message: " + response.transactionResponse.errors[0].errorText);
                }
                else
                {
                    Console.WriteLine("Error Code: " + response.messages.message[0].code);
                    Console.WriteLine("Error message: " + response.messages.message[0].text);
                }
            }
        }
        else
        {
            Console.WriteLine("Null Response.");
        }

        return response;
    }

推荐答案

我使用这个示例项目来解决我的问题.这是在测试模式.

I used this sample project to solve my problem. This is in TEST Mode.

https://github.com/AuthorizeNet/sdk-dotnet/tree/master/CoffeeShopWebApp

这篇关于(13) 商户登录ID或密码无效或账户无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆