Developer
Updated 2 days ago
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:
fw1.ProcessorResponseModel
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:
fw1.PaymentProcessor.doPayment(…)
fw1.PaymentProcessor.doCapturePayment(…)
fw1.PaymentProcessor.doRefundPayment(…)
fw1.PaymentProcessor.doVoidPayment(…)
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.
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:
paymentId – the ID of the payment record to capture
amountToCapture – the amount to capture
completeType – valid values: Complete (everything is captured) or NotComplete (partial capture)
showMessageOnScreen – valid value: false
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:
paymentId – the ID of the payment record to refund
refundType – valid values: Full or Partial
amountToRefund – the amount to refund
refundNote – any note you want saved on the refund activity, maximum length is 255 characters
showMessageOnScreen – valid value: false
Use this method to void a payment.
static fw1.ProcessorResponseModel doVoidPayment(Id paymentId, String voidNote, Boolean showMessageOnScreen)
Pass the following parameters to the method:
paymentId – the ID of the payment record to void
voidNote – any note you want saved on the void activity, maximum length is 255 characters
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:
fw1.ProcessorResponseModel.IsSuccessful – this would indicate whether the transaction is successful or not
fw1.ProcessorResponseModel.Message – any message returned by the transaction