To Implement a Plug-In for Processing Credit Card Payments

In MYOB Acumatica, the Authorize.Net API built-in plug-in processes transactions in Authorize.Net. For more information on this plug-in, see Integration with Authorize.Net Through the API Plug-in. You can implement your own plug-in for working with processing centers other than Authorize.Net, as described in this topic.

To Implement a Credit Card Processing Plug-In

  1. In a class library project, define a class that implements the PX.CCProcessingBase.Interfaces.V2.ICCTransactionProcessor interface, which provides credit card processing functionality. In the class, implement the DoTransaction method, which processes the transaction in the payment gateway.

    The following code shows the declaration of a class that implements the ICCTransactionProcessor interface.

    using PX.CCProcessingBase.Interfaces.V2;
    
    public class MyTransactionProcessor : ICCTransactionProcessor
    {
      public ProcessingResult DoTransaction(ProcessingInput inputData)
      {
        ...
      }
    }
  2. If you need to implement tokenized processing, define the following classes:

    In the classes, implement the methods of the interfaces.

  3. If you need to implement payment processing without the preliminary creation of payment profiles, define the following classes:

    In the classes, implement the methods of the interfaces.

  4. If you need to implement the retrieval of detailed information about transactions, which can be used for the synchronization of transactions with the processing center, define a class that implements the PX.CCProcessingBase.Interfaces.V2.ICCTransactionGetter interface (which provides the methods to obtain information about transactions by transaction ID).
  5. If you need to retrieve the information about suspicious credit card transactions with the Held for Review status (without the use of the hosted form that accepts payments), define a class that implements the supplementary PX.CCProcessingBase.Interfaces.V2.ICCTranStatusGetter interface (which provides the method to obtain the transaction status after the execution of the ICCTransactionProcessor.DoTransaction method). In the class, implement the methods of the interface.
  6. If you need to support webhooks as a way to obtain a response from the processing center, define the following classes:

    In the classes, implement the methods of the interfaces.

  7. Define a class that implements the PX.CCProcessingBase.Interfaces.V2.ICCProcessingPlugin interface, which is the root interface for credit card payment processing and is used by MYOB Acumatica to find the plug-in in the application libraries. The class should have a public parameterless constructor (either explicit or default). In the class, implement the methods of the ICCProcessingPlugin interface as follows:
    • In the ExportSettings method, which exports the required settings from the plug-in to the Processing Centers (CA205000) form, return a collection that contains the settings that can be configured by the user on the form. The syntax of the method is shown in the following code.
      IEnumerable<SettingsDetail> ExportSettings(); 
    • In the ValidateSettings method, validate the settings modified on the Processing Centers form, which are passed as the parameter of the method, and return null if validation was successful or an error message if validation failed. The syntax of the method is shown in the following code.
      string ValidateSettings(SettingsValue setting);
    • In the TestCredentials method, check the connection to the payment gateway by using the credentials that are specified by the user on the Processing Centers form. The syntax of the method is shown in the following code.
      void TestCredentials(IEnumerable<SettingsValue> settingValues);
    • In the CreateProcessor<T> method, return a new object of the T type, and initialize the object with the settings passed to the method. The T type can be any of the following:
      • ICCTransactionProcessor
      • ICCProfileProcessor
      • ICCHostedFormProcessor
      • ICCProfileCreator
      • ICCHostedPaymentFormProcessor
      • ICCTransactionGetter
      • ICCTranStatusGetter
      • ICCWebhookResolver
      • ICCWebhookProcessor
      If a particular T type is not supported by your plug-in, return null for this type. The following code shows a sample implementation of the method.
      public T CreateProcessor<T>(IEnumerable<SettingsValue> settingValues)
        where T : class
      {
        if (typeof(T) == typeof(ICCProfileProcessor))
        {
          return new MyProfileProcessor(settingValues) as T;
        }
        if (typeof(T) == typeof(ICCHostedFormProcessor))
        {
          return new MyHostedFormProcessor(settingValues) as T;
        }
        if (typeof(T) == typeof(ICCHostedPaymentFormProcessor))
        {
          return new MyHostedPaymentFormProcessor(settingValues) as T;
        }
        if (typeof(T) == typeof(ICCHostedPaymentFormResponseParser))
        {
          return new MyHostedPaymentFormResponseParser(settingValues) as T;
        }
        if (typeof(T) == typeof(ICCTransactionProcessor))
        {
          return new MyTransactionProcessor(settingValues) as T;
        }
        if (typeof(T) == typeof(ICCTransactionGetter))
        {
          return new MyTransactionGetter(settingValues) as T;
        }
        if (typeof(T) == typeof(ICCProfileCreator))
        {
          return new MyProfileCreator(settingValues) as T;
        }
        if (typeof(T) == typeof(ICCWebhookResolver))
        {
          return new MyWebhookResolver() as T;
        }
        if (typeof(T) == typeof(ICCWebhookProcessor))
        {
          return new MyWebhookProcessor(settingValues) as T;
        }
        if (typeof(T) == typeof(ICCTranStatusGetter))
        {
          return new MyTranStatusGetter() as T;
        }
        return null;
      }
  8. Build your project.
  9. To add your plug-in to MYOB Acumatica, include the assembly in the customization project. (When the customization project is published, the assembly is copied to the Bin folder of the MYOB Acumatica website automatically.) During startup, the system automatically discovers the class that implements the ICCProcessingPlugin interface and includes it in the list in the Payment Plug-In (Type) box on the Processing Centers form.