Salesforce Billing Standard Objects
CaptureInputParameter Class
CaptureOutputResult Class
REST API for Converting Invoice Lines with Negative Balances
Previous Versions
Stores the results of the payment capture request.
blng
Request
In this example, CaptureInputParameter receives the payment authorization record from Salesforce Billing, a payment capture amount of 4.23, and additional parameters. The parameters are stored in a list and sent to TransactionAPI , which performs the payment capture. CaptureOutputResult contains information about the capture.
1String authId = 'a1wxxxxxxxxxxxxxxx';
2Map<String, Schema.SObjectField> fieldMap = blng__PaymentAuthorization__c.sObjectType.getDescribe().fields.getMap();
3Set<String> fieldNames = fieldMap.keySet();
4SObject myrecord = Database.query('select ' + String.join((Iterable<String>)fieldNames, ',') + ' from blng__PaymentAuthorization__c Where Id = \''+authId+'\'');
5Map<String,String> additionalParams = new Map<String,String>();
6additionalParams.put('merchantReferenceCode','demoCapture');
7
8blng.CaptureInputParameter cip = new blng.CaptureInputParameter();
9cip.setPaymentAuthorization((blng__PaymentAuthorization__c)myrecord);
10cip.setAmount(4.23);
11cip.setAdditionalParameters(additionalParams);
12List<blng.CaptureInputParameter> lcip = new List<blng.CaptureInputParameter>();
13lcip.add(cip);
14List<blng.CaptureOutputResult> result = blng.TransactionAPI.captureTransaction(lcip);
15system.debug(result[0]);Success Response: Following a successful payment capture, CaptureOutputResult returns a success response with the IDs of the payment transaction and payment created in Salesforce Billing.
1[CaptureOutputResult.errorMessage=null, CaptureOutputResult.isSuccess=true,
2paymentId=a25xxxxxxxxxxxxxxx, paymentTransactionId=a24xxxxxxxxxxxxxxx]Failure Response: Following a failed payment capture, CaptureOutputResult returns a failure response with an error message and the ID of the payment transaction created in Salesforce Billing. The payment transaction contains information about the failed gateway communication.
1[CaptureOutputResult.errorMessage=Invalid data. c:authRequestID,
2CaptureOutputResult.isSuccess=false, paymentId=null, paymentTransactionId=a24xxxxxxxxxxxxxxx]The following are methods for CaptureOutputResult.
Sets the ID of the Salesforce Billing payment record created after a successful capture transaction.
Returns the ID of the Salesforce Billing payment record that was created after a successful capture transaction.
setPaymentTransactionId(paymentTransactionId)
Sets the ID of the Salesforce Billing payment transaction record that was created after a successful capture transaction.
Returns the ID of the Salesforce Billing payment transaction record created after a successful capture transaction.
Sets the ID of the Salesforce Billing payment record created after a successful capture transaction.
global static void setPaymentId(Id paymentId)
paymentId: Type: Id ID of the payment record created in Salesforce Billing. The payment record stores information about the payment.
Type: void
Returns the ID of the Salesforce Billing payment record that was created after a successful capture transaction.
global static Id getPaymentId()
Type: Id
Sets the ID of the Salesforce Billing payment transaction record that was created after a successful capture transaction.
public static void setPaymentTransactionId(Id paymentTransactionId)
paymentTransactionId: Type: Id ID of the payment transaction record created in Salesforce Billing. This record stores the results of the communication with the payment gateway.
Type: void
Returns the ID of the Salesforce Billing payment transaction record created after a successful capture transaction.
global static Id getPaymentTransactionId()
Type: Id