Accounting Apex API Developer Reference

c2g.PaymentsPlusService

global with sharing class PaymentsPlusService

the service class relating to payments plus.

Enums

CheckStatus

Indicates the status of the check you want to create.

Value Description
StatusValid Use this to indicate the check is valid.
StatusVoid Use this to indicate that this check number is associated with a canceled, damaged, lost, or otherwise spoiled check.
StatusManual Use this to indicate the check number has been cut manually.

Methods

addToProposal

global static List<Id> addToProposal(Id paymentId, List<Id> transactionLineIds)

This method adds the selected transactions to the payment proposal. Use the ManagePayments (Manage Payments) custom permission to grant permissions on this method.

Input Parameters

Name Type Description
paymentId Id The payment ID for the proposal you want to add transactions to.
transactionLineIds List<Id> A list of transaction line item IDs to add to the payment proposal. For payments with select invoice for separate payment checked you can only add transaction lines that belong to a transaction of Payable Invoice's type.

Return Value

This service returns a list containing all new log IDs generated during the Add to Proposal process.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

Id paymentId = 'a2R0O000005ddmY';
List<Id> transactionLineIds = new List<Id>{'a2n0O000000YWVb', 'a2n0O000000YWVg'};

List<Id> logIds = c2g.PaymentsPlusService.addToProposal(paymentId, transactionLineIds);

addToProposal

global static List<Id> addToProposal(Id paymentId, List<c2g.PaymentsPlusService.ProposalLine> proposalLines)

This method adds part payment transactions to the payment proposal. Use the ManagePayments (Manage Payments) custom permission to grant permissions on this method.

Input Parameters

Name Type Description
paymentId Id The payment ID for the proposal you want to add transactions to.
proposalLines List<c2g.PaymentsPlusService.ProposalLine> A list of proposal lines to add to the payment proposal. For payments with select invoice for separate payment checked you can only add transaction lines that belong to a transaction of Payable Invoice's type.

Return Value

This service returns a list containing all new log IDs generated during the Add to Proposal process.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

Id paymentId = 'a2R0O000005ddmY';
c2g.PaymentsPlusService.ProposalLine proposalLine = new c2g.PaymentsPlusService.ProposalLine();
proposalLine.TransactionLineItemId = 'a2n0O000000YWVb';
proposalLine.PaymentValue = -45;
List<c2g.PaymentsPlusService.ProposalLine> proposalLines = new List<c2g.PaymentsPlusService.ProposalLine>{proposalLine};

List<Id> logIds = c2g.PaymentsPlusService.addToProposal(paymentId, proposalLines);

removeFromProposal

global static List<Id> removeFromProposal(Id paymentId, List<Id> transactionLineIds)

This method removes the selected transactions from the payment proposal. Use the ManagePayments (Manage Payments) custom permission to grant permissions on this method.

Input Parameters

Name Type Description
paymentId Id The payment ID for the proposal you want to remove transactions from.
transactionLineIds List<Id> A list of transaction line item IDs to remove from the payment proposal.

Return Value

This service returns a list containing all new Log IDs generated during the Remove from Proposal process.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

Id paymentId = 'a2R0O000005ddmY';
List<Id> transactionLineIds = new List<Id>{'a2n0O000000YWVb', 'a2n0O000000YWVg'};

List<Id> logIds = c2g.PaymentsPlusService.removeFromProposal(paymentId, transactionLineIds);

createMediaData

global static Id createMediaData(Id paymentId)

This method generates the payment information needed for bank files or to print checks. Use the ManagePayments (Manage Payments) custom permission to grant permissions on this method.

Input Parameters

Name Type Description
paymentId Id The payment ID for which you want to generate the media information.

Return Value

This service returns the ID of the payment media control related to the selected payment Id.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

Id paymentId = 'a2R0O000005ddmY';

Id paymentMediaControlId = c2g.PaymentsPlusService.createMediaData(paymentId);

createMediaDataAsync

global static Id createMediaDataAsync(Id paymentId)

This method generates the payment information needed for bank files or to print checks. It runs in the background and you will be notified when it finishes. Use the ManagePayments (Manage Payments) custom permission to grant permissions on this method.

Input Parameters

Name Type Description
paymentId Id The payment ID for which you want to generate media data.

Return Value

This service returns the ID of the batch process record for the job.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

Id paymentId = 'a2R0O000005ddmY';

Id batchProcessId = c2g.PaymentsPlusService.createMediaDataAsync(paymentId);

updateCheckNumbers

global static void updateCheckNumbers(Id paymentId, List<c2g.PaymentsPlusService.Check> checks)

This method updates the check numbers associated with the selected payment. Use the ManagePayments (Manage Payments) custom permission to grant permissions on this method.

Input Parameters

Name Type Description
paymentId Id The ID for the payment proposal that you want to update check numbers for.
checks List<c2g.PaymentsPlusService.Check> A list of c2g.PaymentsPlusService.Check instances.

Return Value

This service does not return a value.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

// Check per account
Id paymentId = 'a2R0O000005ddmY';
c2g.PaymentsPlusService.Check check1 = new c2g.PaymentsPlusService.Check();
check1.AccountId = '0010O00001qWdCD';
check1.CheckNumber = 1;
check1.Status = c2g.PaymentsPlusService.CheckStatus.StatusValid;

c2g.PaymentsPlusService.Check check2 = new c2g.PaymentsPlusService.Check();
check2.CheckNumber = 2;
check2.Status = c2g.PaymentsPlusService.CheckStatus.StatusManual;

c2g.PaymentsPlusService.Check check3 = new c2g.PaymentsPlusService.Check();
check3.CheckNumber = 3;
check3.Status = c2g.PaymentsPlusService.CheckStatus.StatusVoid;

List<c2g.PaymentsPlusService.Check> checks = new List<c2g.PaymentsPlusService.Check>{check1, check2, check3};

c2g.PaymentsPlusService.updateCheckNumbers(paymentId, checks);


// Select invoice for separate payment
Id paymentId = 'a2R0O000005ddmY';
c2g.PaymentsPlusService.Check check1 = new c2g.PaymentsPlusService.Check();
check1.TransactionLineItemId = 'a5K2D000000O03DUAS';
check1.CheckNumber = 1;
check1.Status = c2g.PaymentsPlusService.CheckStatus.StatusValid;

c2g.PaymentsPlusService.Check check2 = new c2g.PaymentsPlusService.Check();
check2.CheckNumber = 2;
check2.Status = c2g.PaymentsPlusService.CheckStatus.StatusManual;

c2g.PaymentsPlusService.Check check3 = new c2g.PaymentsPlusService.Check();
check3.CheckNumber = 3;
check3.Status = c2g.PaymentsPlusService.CheckStatus.StatusVoid;

List<c2g.PaymentsPlusService.Check> checks = new List<c2g.PaymentsPlusService.Check>{check1, check2, check3};

c2g.PaymentsPlusService.updateCheckNumbers(paymentId, checks);

postAndMatchAsync

global static Id postAndMatchAsync(Id paymentId)

This method does the post and match for the given payment proposal. It runs in the background and you will be notified when it finishes. Use the PostandMatchPayments (Post and Match Payments) custom permission to grant permissions on this method.

Input Parameters

Name Type Description
paymentId Id The ID for the payment proposal that you want to post and match.

Return Value

This service returns the ID of the batch process record for the job or null if running off platform.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

Id paymentId = 'a2R0O000005ddmY';
Id batchProcessId = c2g.PaymentsPlusService.postAndMatchAsync(paymentId);

discardAsync

global static Id discardAsync(Id paymentId)

This method performs the discard for the selected payment proposal. It runs in the background and you will be notified when it finishes. Use the DiscardPayments (Discard Payments) custom permission to grant permissions on this method.

Input Parameters

Name Type Description
paymentId Id The ID for the payment proposal that you want to discard.

Return Value

This service returns the ID of the batch process record for the job.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

Id paymentId = 'a2R0O000005ddmY';
Id batchProcessId = c2g.PaymentsPlusService.discardAsync(paymentId);

removeAccountsAsync

global static Id removeAccountsAsync(Id paymentId, List<Id> accountIds, String removeAccountsReason)

This method removes the selected accounts from the selected payment proposal. This method only applies to electronic payments. It runs in the background and you will be notified when it finishes. Use the ManagePayments (Manage Payments) custom permission to grant permissions on this method.

Input Parameters

Name Type Description
paymentId Id The ID for the payment proposal you want to remove accounts from.
accountIds List<Id> The list of account IDs that will be removed from the selected payment ID.
removeAccountsReason String A string containing the reason why the accounts were removed.

Return Value

This service returns the ID of the batch process record for the job.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

Id paymentId = 'a2R0O000005ddmY';
List<Id> accountIds = new List<Id>{'0011I000008Pt2G', '0011I000008Pt27', '0011I000008Pt26'};
String removeAccountsReason = 'Reason';

Id batchProcessId = c2g.PaymentsPlusService.removeAccountsAsync(paymentId, accountIds, removeAccountsReason);

cancelPaymentAsync

global static Id cancelPaymentAsync(Id paymentId, c2g.PaymentsPlusService.CancelPaymentCriteria cancelCriteria)

This method cancels all the available accounts from a payment proposal using the selected criteria. Use the CancelPayments (Cancel Payments) custom permission to cancel all payments proposals. It runs in the background and you will be notified when it finishes.

Input Parameters

Name Type Description
paymentId Id The ID for the payment proposal that you want to cancel accounts for.
cancelCriteria c2g.PaymentsPlusService.CancelPaymentCriteria The information that will be used to cancel the accounts in the payment.

Return Value

This service returns the ID of the batch process record for the job.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

Id paymentId = 'a2R0O000005ddmY';

c2g.PaymentsPlusService.CancelPaymentCriteria cancelPaymentCriteria = new c2g.PaymentsPlusService.CancelPaymentCriteria();
cancelPaymentCriteria.CancelReason = 'Cancel reason';
cancelPaymentCriteria.PaymentRefundDate = System.today();
cancelPaymentCriteria.PaymentRefundPeriod = 'a2S0O00000IKas0';
cancelPaymentCriteria.UndoMatchDate = System.today();
cancelPaymentCriteria.UndoMatchPeriod = 'a2S0O00000IKas0';

Id batchProcessId = c2g.PaymentsPlusService.cancelPaymentAsync(paymentId, cancelPaymentCriteria);

cancelPaymentAsync

global static Id cancelPaymentAsync(Id paymentId, c2g.PaymentsPlusService.CancelPaymentCriteria cancelCriteria, List<Id> entityIds)

This method cancels a list of accounts or payable invoices from a payment proposal using the selected criteria. Use the CancelPayments (Cancel Payments) custom permission to cancel all payments proposals. It runs in the background and you will be notified when it finishes.

Input Parameters

Name Type Description
paymentId Id The ID for the payment proposal that you want to cancel accounts or transaction line items for.
cancelCriteria c2g.PaymentsPlusService.CancelPaymentCriteria The information that will be used to cancel the accounts or transaction line items in the payment.
entityIds List<Id> The list of account or transaction line item IDs that will be canceled for the selected payment ID.

Return Value

This service returns the ID of the batch process record for the job.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

Id paymentId = 'a2R0O000005ddmY';

c2g.PaymentsPlusService.CancelPaymentCriteria cancelPaymentCriteria = new c2g.PaymentsPlusService.CancelPaymentCriteria();
cancelPaymentCriteria.CancelReason = 'Cancel reason';
cancelPaymentCriteria.PaymentRefundDate = System.today();
cancelPaymentCriteria.PaymentRefundPeriod = 'a2S0O00000IKas0';
cancelPaymentCriteria.UndoMatchDate = System.today();
cancelPaymentCriteria.UndoMatchPeriod = 'a2S0O00000IKas0';

List<Id> accountIds = new List<Id>{'0010O00001qWdC3', '0010O00001qWdC6'};

Id batchProcessId = c2g.PaymentsPlusService.cancelPaymentAsync(paymentId, cancelPaymentCriteria, accountIds);

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

Id paymentId = 'a2R0O000005ddmY';

c2g.PaymentsPlusService.CancelPaymentCriteria cancelPaymentCriteria = new c2g.PaymentsPlusService.CancelPaymentCriteria();
cancelPaymentCriteria.CancelReason = 'Cancel reason';
cancelPaymentCriteria.PaymentRefundDate = System.today();
cancelPaymentCriteria.PaymentRefundPeriod = 'a2S0O00000IKas0';
cancelPaymentCriteria.UndoMatchDate = System.today();
cancelPaymentCriteria.UndoMatchPeriod = 'a2S0O00000IKas0';

List<Id> tliIds = new List<Id>{'a5O1F000000Lr7SUAS', 'a5O1F000000Lr7UUAS'};

Id batchProcessId = c2g.PaymentsPlusService.cancelPaymentAsync(paymentId, cancelPaymentCriteria, tliIds);

resubmitCancelPaymentAsync

global static Id resubmitCancelPaymentAsync(Id paymentId)

This method resubmits the cancel process to cancel all remaining accounts from a previously canceled payment proposal. Use the CancelPayments (Cancel Payments) custom permission to resubmit all payments proposals to cancel. It runs in the background and you will be notified when it finishes.

Input Parameters

Name Type Description
paymentId Id The ID of the payment proposal you want to cancel accounts for.

Return Value

This service returns the ID of the batch process record for the job.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

Id paymentId = 'a2R0O000005ddmY';

Id batchProcessId = c2g.PaymentsPlusService.resubmitCancelPaymentAsync(paymentId);

c2g.PaymentsPlusService.Check

global virtual class Check implements Comparable

holds the information needed to create checks through the updatechecknumbers api.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

// Check per account
c2g.PaymentsPlusService.Check check = new c2g.PaymentsPlusService.Check();
check.AccountId = '0010O00001qWdCD';
check.CheckNumber = 42;
check.Status = c2g.PaymentsPlusService.CheckStatus.StatusValid;


// Select invoice for separate payment
c2g.PaymentsPlusService.Check check = new c2g.PaymentsPlusService.Check();
check.TransactionLineItemId = 'a5K2D000000O03DUAS';
check.CheckNumber = 42;
check.Status = c2g.PaymentsPlusService.CheckStatus.StatusValid;

Properties

Name Type Description
AccountId Id the id for the account that you want to create a check for.
TransactionLineItemId Id the id for the transaction line item that you want to create a check for.
CheckNumber Integer the number you want to assign to the valid or void check.
Status c2g.PaymentsPlusService.CheckStatus the status of the check you want to create or void. see c2g.paymentsplusservice.checkstatus enum for a list of valid statuses.

Methods

Check

global Check()

Holds the API representation of a check.

Return Value

This constructor does not return a value.

c2g.PaymentsPlusService.CancelPaymentCriteria

global class CancelPaymentCriteria

holds the canceling information needed to perform a cancel payment operation.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

c2g.PaymentsPlusService.CancelPaymentCriteria cancelPaymentCriteria = new c2g.PaymentsPlusService.CancelPaymentCriteria();
cancelPaymentCriteria.CancelReason = 'Cancel reason';
cancelPaymentCriteria.PaymentRefundDate = System.today();
cancelPaymentCriteria.PaymentRefundPeriod = 'a2S0O00000IKas0';
cancelPaymentCriteria.UndoMatchDate = System.today();
cancelPaymentCriteria.UndoMatchPeriod = 'a2S0O00000IKas0';

Properties

Name Type Description
CancelReason String the reason why you want to cancel the accounts.
PaymentRefundDate Date the date you want to use for the refund cash entry.
PaymentRefundPeriod Id the id of the period you want to use for the refund cash entry.
UndoMatchDate Date the date you want to use for the underlying undo match operation.
UndoMatchPeriod Id the id of the period you want to use for the underlying undo match operation.

Methods

CancelPaymentCriteria

global CancelPaymentCriteria()

Holds the criteria used for the Cancel Payment operation.

Return Value

This constructor does not return a value.

c2g.PaymentsPlusService.ProposalLine

global class ProposalLine

Batch Control Log Message field

Properties

Name Type Description
TransactionLineItemId Id the id of the transaction line item to be added to the proposal.
PaymentValue Decimal the payment value of the transaction to be added to the proposal.

Methods

ProposalLine

global ProposalLine()

Holds the API representation of the transaction line to be added to the payment proposal.

Return Value

This constructor does not return a value.

© Copyright 2009–2022 FinancialForce.com, inc. All rights reserved. Various trademarks held by their respective owners.