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
- 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) { ... } }
- If you need to implement tokenized processing, define the following classes:
- A class that implements the PX.CCProcessingBase.Interfaces.V2.ICCProfileProcessor interface (which provides methods to manage customer and payment profiles)
- A class that implements the PX.CCProcessingBase.Interfaces.V2.ICCHostedFormProcessor interface (which provides methods to work with hosted forms for the creation and management of payment profiles)
In the classes, implement the methods of the interfaces.
- If you need to implement payment processing without the preliminary creation of payment
profiles, define the following classes:
- A class that implements the PX.CCProcessingBase.Interfaces.V2.ICCProfileCreator interface (which provides the method to create the payment profile for a new credit card)
- A class that implements the PX.CCProcessingBase.Interfaces.V2.ICCHostedPaymentFormProcessor interface (which provides methods to work with hosted forms for processing payments without preliminary creation of payment profiles)
- A class that implements the PX.CCProcessingBase.Interfaces.V2.ICCHostedPaymentFormResponseParser interface (which provides a method to parse the response after a successful operation on a hosted form that processes payments without preliminary creation of payment profiles)
- A class that implements the PX.CCProcessingBase.Interfaces.V2.ICCTransactionGetter interface (which provides the methods to obtain information about transactions by transaction ID)
In the classes, implement the methods of the interfaces.
- 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).
- 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.
- If you need to support webhooks as a way to obtain a response from the processing
center, define the following classes:
- A class that implements the PX.CCProcessingBase.Interfaces.V2.ICCWebhookProcessor interface (which provides the methods to add, update, and delete webhooks and retrieve the list of webhooks)
- A class that implements the PX.CCProcessingBase.Interfaces.V2.ICCWebhookResolver interface (which parses the information that comes from the processing center through webhooks)
In the classes, implement the methods of the interfaces.
- 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, returnnull
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; }
- 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.
- Build your project.
- 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.