Payment Global Classes

If you have built your own app and wanted to add credit card payment functionality, you can take advantage of our global classes so you don’t have to write your own.

To process a payment, there are two global classes involved:

  1. fw1.ProcessorResponseModel
  2. fw1.PaymentProcessor


This class is used as a return type, it contains the response of the transaction. The following are the properties of the class.

String AuthorizationCode
Datetime AvailableOnDate
String AvsCode
String AvsResult
Integer Code
Datetime CreatedDate
String CustomerProfileId
String CvcCode
String CvcResult
String Email
String ErrorCode
String ErrorType
Boolean IsPendingSettlement
Boolean IsSuccessful
String Message
Decimal NetAmount
Decimal ProcessingFee
String ReasonCode
String ReconciliationId
String ReferenceId
String RequestToken
String TransactionId
List Transactions
String TransactionStatus

Please note that there maybe additional properties that are added every now and then.


This class contains the methods used to process payment transactions. It has the following methods:

  1. fw1.PaymentProcessor.doPayment(…)
  2. fw1.PaymentProcessor.doCapturePayment(…)
  3. fw1.PaymentProcessor.doRefundPayment(…)
  4. fw1.PaymentProcessor.doVoidPayment(…)


doPayment Method

Use this method to process payment.

static Boolean doPayment(fw1__Payment__c payment)

For more information on how to use this method, please follow this link.


doCapturePayment Method

Use this method to capture previously authorized payment.

static fw1.ProcessorResponseModel doCapturePayment(Id paymentId, Decimal amountToCapture, String completeType, Boolean showMessageOnScreen)

Pass the following parameters to the method:

  1. paymentId – the ID of the payment record to capture
  2. amountToCapture – the amount to capture
  3. completeType – valid values: Complete (everything is captured) or NotComplete (partial capture)
  4. showMessageOnScreen – valid value: false


doRefundPayment Method

Use this method to refund a payment.

static fw1.ProcessorResponseModel doRefundPayment(Id paymentId, String refundType, Decimal amountToRefund, String refundNote, Boolean showMessageOnScreen)

Pass the following parameters to the method:

  1. paymentId – the ID of the payment record to refund
  2. refundType – valid values: Full or Partial
  3. amountToRefund – the amount to refund
  4. refundNote – any note you want saved on the refund activity, maximum length is 255 characters
  5. showMessageOnScreen – valid value: false


doVoidPayment Method

Use this method to void a payment.

static fw1.ProcessorResponseModel doVoidPayment(Id paymentId, String voidNote, Boolean showMessageOnScreen)

Pass the following parameters to the method:

  1. paymentId – the ID of the payment record to void
  2. voidNote – any note you want saved on the void activity, maximum length is 255 characters
  3. showMessageOnScreen – valid value: false


For the methods using fw1.ProcessorResponseModel as the return type, each method would populate different properties. The most important properties however are as follows:

  1. fw1.ProcessorResponseModel.IsSuccessful – this would indicate whether the transaction is successful or not
  2. fw1.ProcessorResponseModel.Message – any message returned by the transaction


Was this article helpful?

Related Articles

Comments are closed.

  • About Us builds enterprise apps on the platform. We have created some of the most popular apps on the AppExchange, and are being used by over 2000+ Salesforce users and continues to grow.

  • Our Culture

    As a company, we believe in simple. So we build simple applications out of complex processes. We also provide unparalleled customer support because we truly believe that our customers' success is our success. Read more on what our customers say about us.
  • Check Our Customer Reviews

Copyright © 2020, Inc.
21151 S. Western Ave., Suite 215, Torrance, CA 90501, USA
All trademarks, trade names and logos appearing on the site are the property of their respective owners.
^ Back to Top