Share via


How to Use a Custom Payment Method from Site Code

After you create a custom payment method, you must incorporate the new payment method into your site code. The changes to your site code include creating a new class to represent the new type of payment, and creating an instance of the class when the user chooses the new payment method.

Note

When you view an order in the Customer and Orders Manager, you will only see cash card, credit card, gift certificate, and purchase order payments. If you create a new type of payment by extending the Payment class, you must use the Commerce Server Core Systems SDK to extend the user interface of the Customer and Orders Manager to view the new type of payment.

To use a custom payment method from your site code

  1. Extend the Payment class to create a new class that represents paying by the new payment method. For more information about how to extend a core Orders System class, see How to Derive a New Orders Class.

  2. Override the accessors on the ProtectedPaymentType member of the new class. The get accessor should return the payment type property that you selected when you created the new payment method. For information about how to view the properties of the payment method, see How to View Payment Method Details.

  3. Modify your site code to create an instance of the class that you defined in the first step when the user chooses to pay by using the new payment method.

  4. Update the OrderObjectMappings.xml file to map instances of the new class to the database. For more information about the OrderObjectMappings.xml file, see Mapping Purchase Orders to the Database.

  5. Generate and run the SQL stored procedures to update the database. For more information about how to generate the SQL stored procedures, see How to Generate SQL Tables and Stored Procedures for Orders Mapped Storage.

  6. Update the Types element in the Web.config file. For more information about this element, see Types Element.

See Also

Other Resources

How to Derive a New Orders Class

Mapping Purchase Orders to the Database

How to Configure a Custom Payment Method

Creating a Custom Payment Method