Netaxept payment provider tips

Created by Webnodes

The Netaxept payment provider has a number of features that can be enabled. Below I'll show some of the options available.

All payment methods in Webnodes implement the same interface. But some payment methods have specific data needs that we don't want to include in the standard API. These needs are supported mainly through the PaymentMethodData class, and the PaymentData property. The PaymentData is of type Dictionary<string, string>. 

If a provider needs some specific data that isn't a part of the standard properties on PaymentMethodData, you can add the through the dictionary, and the provider can check if a specific key exists in the dictionary. 

This is how some of the additional features in Netaxept is supported. For example, in some cases you want to limit the payment methods available. This can be done by adding a dictionary entry to PaymentData that has the key of "paymentMethodActionList". The value is a comma separated list of payment methods you want to be enabled for the current payment.

The valid payment methods can be found on https://shop.nets.eu/nb/web/partners/register. See the Payment Method Action List section. Note that the payment methods you include in the comma separated list must be enabled in the admin interface for them to show up. 

When starting the payment process, you normally create the PaymentMethodData object:

 PaymentMethodData pmd = new PaymentMethodData();
 pmd.CurrencyNodeId = shop.DefaultCurrency.GetId();
 pmd.OrderId = order.NodeId.ToString();
 pmd.Amount = order.GetCurrentCartPriceIncVatAndShipping(true, true);
 pmd.PaymentMethodNodeId = order.PaymentMethod.GetId();
 pmd.ClientIPAddress = Request.UserHostAddress;

To select which payment methods you want to enable, do like this:

pmd.PaymentData.Add("paymentMethodActionList", "Visa,PayPal,Vipps");

Note that in earlier versions of Netaxept, you would use the "PaymentMethodList". This can still be used, but it is deprecated, so we recommend using paymentMethodActionList. If you insist on using the old method, you can add "paytype" to PaymentData, again with a comma separated list:

pmd.PaymentData.Add("paytype", "Visa,PayPal,Vipps");

Adding customer data

One optional feature you can make use of  in Netaxept is sending the customer data to Netaxept. This will be shown in the admin panel related to each payment, but some payment methods may require or recommend that you add additional data.

For example, if you supply the mobile phone number to Netaxept, the payment method Vipps doesn't need to prompt the user for the mobile number in the Netaxept window. There are two steps to using the customer data:

1.) Add the "NetaxeptCreateCustomer" key to the PaymentData property. The value can be anything.

2.) Add the customer properties you need. The keys used are the Rest property names from the Customer section in the documentation.

pmd.PaymentData.Add("NetaxeptCreateCustomer", "Yes");
pmd.PaymentData.Add("customerPhoneNumber", "2233445566");