Creating settings for Authorize.Net payment processor

To create settings for the Authorize.Net payment processor, you must perform the following:

  1. Create the settings object.
    Create an instance of the AuthorizeNetSettings class.
  2. Set the properties of the instance.
    In this example, the following properties are set:
    • ApiVersion
      Gets or sets the version of the API.
    • PaymentType
      Gets or sets the type of the payment. For more information about the values of this property, see the Payment processors topic.
    • ProcessorCreditCards
      Gets or sets the array of credit card names that are supported by the payment method. For more information about the supported credit card names, see the Payment processors topic.
    • Timeout
      Gets or sets the timeout for post to the payment processor
  3. Check whether the settings are intended for testing.
    If the settings are intended for testing, set the following properties:
    • ProcessingMode
      Gets or sets the processing mode of the payment method. It can have a value of either “test” or “live”.
    • TestLoginId
      Gets or sets the login ID used in test mode.
    • TestTransactionKey
      Gets or sets the transaction key used in test mode.
    • TestUrl
      Gets or sets the URL used in test mode.
    If the settings are intended for real-time use, set the following properties:
    • ProcessingMode
      Gets or sets the processing mode of the payment method. It can have a value of either “test” or “live”.
    • LiveLoginId
      Gets or sets the login ID used in live mode.
    • LiveTransactionKey
      Gets or sets the transaction key used in live mode.
    • LiveUrl
      Gets or sets the URL used in live mode.
    TIP: The respective properties that have no prefix of "Live-" and "Test-", return the value of the test or the live property depending on the value of the TestMode property.

  4. Serialize the settings into a JSON string.
    Because the PaymentProcessorSettings property of the PaymentMethod class is of type string, you must serialize the settings into a JSON string in order to assign them to a payment method. To do this perform the following:
    1. Create an instance of the JavaScriptSerializer class.
    2. Serialize the settings by calling the Serialize method.

Here is a code example:

public static string CreateAuthorizeNetSettings(string apiVersion, string paymentType, bool isTest, string loginId, string transactionKey, string url, string[] creditCards, double timeout)
{
    AuthorizeNetSettings settings = new AuthorizeNetSettings();
 
    settings.ApiVersion = apiVersion;
    settings.PaymentType = paymentType;
    settings.ProcessorCreditCards = creditCards;
    settings.Timeout = timeout;
 
    if (isTest)
    {
        settings.ProcessingMode = "test";
        settings.TestLoginId = loginId;
        settings.TestTransactionKey = transactionKey;
        settings.TestURL = url;
    }
    else
    {
        settings.ProcessingMode = "live";
        settings.LiveLoginId = loginId;
        settings.LiveTransactionKey = transactionKey;
        settings.LiveURL = url;
    }
 
    JavaScriptSerializer serializer = new JavaScriptSerializer();
 
    string settingsJson = serializer.Serialize(settings);
 
    return settingsJson;
}

Next steps

+1-888-365-2779
sales@sitefinity.com

Related topics:

Feedback

How useful is this article?

Tell us more

Submit
Your message was successfully sent.

We appreciate your feedback.

Your message could not be sent.

OK