Create payment methods

This topic contains the following:

  • Creating a payment method that uses a payment processor
  • Creating an offline payment method

For more information about payment processor and payment processor settings, see the For developers: Payment processors section.

Creating a payment method that uses a payment process

To create a payment method that uses a payment processor, you must perform the following:

  1. Get the orders manager.
    Get an instance of the OrdersManager object.
  2. Create new payment method.
    To create a new payment method, call the CreatePaymentMethod method of the orders manager.
  3. Set the properties of the payment method.
    In this example the following properties of the PaymentMethod instance are set:
    • Title
      Gets or sets the title of the payment method.
    • PaymentMethod
      Gets or sets whether the payment is offline or uses payment processor. In this example the property is set to PaymentMethodType.PaymentProcessor.
    • Description
      Gets or sets the description of the payment method.
    • IsActive
      Specifies whether the payment method is active and can be used.
  4. Set the payment processor.
    To set the payment processor, you must perform the following:
    1. Set the ID of the processor.
      For more information about how to get the ID of one of the available payment processor providers, see For developers: Query payment processor providers.
    2. Set the processor settings.
      For the PaymentProcessorSettings property, you must specify a string in JSON format. For more information how to create settings for the different payment processors, see the For developers: Payment processors section.
  5. Save the changes.
    Save the changes to the orders manager.
Here is a code example:


Creating an offline payment method

To create an offline payment method, you must perform the following:

  1. Get the orders manager.
    Get an instance of the OrdersManager object.
  2. Create new payment method.
    To create a new payment method, call the CreatePaymentMethod method of the orders manager.
  3. Set the properties of the payment method.
    In this example the following properties of the PaymentMethod instance are set:
    • Title
      Gets or sets the title of the payment method.
    • PaymentMethod
      Gets or sets whether the payment is offline or uses payment processor. In this example the property is set to PaymentMethodType.Offline.
    • Description
      Gets or sets the description of the payment method.
    • IsActive
      Specifies whether the payment method is active and can be used.
  4. Save the changes.
    Save the changes to the orders manager.
Here is a code example:


Want to learn more?

Sign up for our free beginner training. Boost your credentials through advanced courses and certification.
Register for Sitefinity training and certification.

Was this article helpful?