Payment Connect

Automations

This document outlines the available automation capabilities within the Payment Connect application, enabling users to streamline and trigger various payment-related actions programmatically. It includes detailed examples and field requirements for automating ACH payments, generating payment links, processing payments using saved methods, initiating fund transfers, and issuing refunds.


1. Automate Requesting ACH Payment

Automate Payment

This automation allows you to initiate an ACH (Pay by Bank) payment directly from a Salesforce record. It supports both immediate and scheduled payments using manually entered bank details. Ideal for scenarios where customers prefer not to use cards and want to schedule payments from checking or savings accounts.

Use this when:
✅ You want to collect payment via bank account.
✅ The customer has not saved a payment method yet.
✅ You need to schedule the payment for a future date.

1.1 Wrapper Fields

Field Name

Description

Required

Possible Values / Notes

name

Mode of Payment

✅ Yes

bank, card

recordId

ID of the Parent Record to which the Payment Transaction will be linked

✅ Yes

Must be a valid Salesforce Record ID

gatewayId

ID of the Payment Gateway record

✅ Yes

Must be a valid Payment Gateway record ID

paymentMethodId

ID of the existing Payment Method record

❌ Optional

Required only if reusing an existing payment method

amount

Amount (up to 4 decimal places)

✅ Yes

Example: 12, 12.12, 12.2345

applicationFees

Any additional application fee to include

❌ Optional

Decimal

scheduleDate

Date to schedule the payment. Defaults to the current date if not provided

❌ Optional

Format: YYYY-MM-DD

selectedFrequency

How the payment should be processed

❌ Optional

Same Day, Instant, Regular

accountNunber

Bank Account Number

✅ Yes

Required for ACH (bank) payments

routingNumber

Bank Routing Number

✅ Yes

Required for ACH (bank) payments

accountName

Name of the Account Holder

✅ Yes

-

paymentMode

ACH Account Type

✅ Yes

Checking, Savings

zip

ZIP Code

❌ Optional

-

address

Street Address

❌ Optional

-

state

State (2-letter code)

❌ Optional

Example: NY, CA

city

City

❌ Optional

-

accountId

Related Account ID

❌ Optional

-

contactId

Related Contact ID

❌ Optional

-

relatedRecordIds

Comma-separated list of related record IDs (e.g., Opportunity, Case)

❌ Optional

Format: a01...,a02...,a03...

phone

Customer’s phone number

❌ Optional

Used if sending payment request via SMS

email

Customer’s email address

❌ Optional

Used if sending payment request via email

sendViaSms

If true, sends the payment request via SMS

❌ Optional

true / false

InvocableAutomatePaymentProcess.PaymentRequestWrapper oWrapper = new InvocableAutomatePaymentProcess.PaymentRequestWrapper();

// Required fields
oWrapper.name = 'Bank'; // or 'Card'
oWrapper.recordId = '<Parent Record ID>'; // e.g., Account/Opportunity ID
oWrapper.gatewayId = '<Payment Gateway Record ID>';
oWrapper.amount = 123.4567; // up to 4 decimal places
oWrapper.scheduleDate = Date.today(); // or any future date
oWrapper.scheduleDate = Date.today(); // or any future date
oWrapper.selectedFrequency = 'Regular'; 

// If no saved Payment Method is used
oWrapper.accountNunber = '123456789';
oWrapper.routingNumber = '021000021';
oWrapper.accountName = 'John Doe';
oWrapper.paymentMode = 'Checking'; // or 'Savings'

// Optional Address Information
oWrapper.zip = '10001';
oWrapper.address = '123 Main Street';
oWrapper.state = 'NY'; // 2-character state code
oWrapper.city = 'New York';

// Optional Extras
oWrapper.paymentMethodId = '<Existing Payment Method ID>'; // If available
oWrapper.applicationFees = 2.50; // Optional fee amount
oWrapper.accountId = '<Account Record ID>'; // If applicable
oWrapper.contactId = '<Contact Record ID>'; // If applicable
oWrapper.relatedRecordIds = '006XXXXXX,500XXXXXX'; // Comma-separated related records
oWrapper.phone = '1234567890';
oWrapper.email = 'johndoe@example.com';
oWrapper.sendViaSms = true;

InvocableAutomatePaymentProcess.automatePayment(
    new List<InvocableAutomatePaymentProcess.PaymentRequestWrapper>{ oWrapper }
);

Example:

InvocableAutomatePaymentProcess.PaymentRequestWrapper oWrapper = new  InvocableAutomatePaymentProcess.PaymentRequestWrapper();
oWrapper.name = 'bank';
oWrapper.recordId = '003fK000003NU2HQAW';
oWrapper.gatewayId = 'a09fK000001vpBhQAI';
oWrapper.amount = 1.0;
oWrapper.scheduleDate = Date.today() + 5;
oWrapper.accountNunber = '1234567';
oWrapper.routingNumber = '123456780';
oWrapper.accountName = 'S S';
oWrapper.paymentMode = 'Checking';
oWrapper.zip = '32123';
oWrapper.address = 'sdfsf';
oWrapper.state = 'GA';
oWrapper.city = 'fsdf';
String sResponse = InvocableAutomatePaymentProcess.automatePayment(new List<InvocableAutomatePaymentProcess.PaymentRequestWrapper>{oWrapper});

1.2 Response

Response is a serialize Map. It has below attributes:

Field Name

Type

Description

isSuccess

Boolean

Tells whether the process was success or not

transactionid

String

Reference id from the gateway

paymentStatus

String

Current Payment Status

statusCode

Number

API Status code. E.g. 200

errorMessage

String

Error Details if any error comes while processing the payment

paymentTransactionId

Id

Payment Transaction record Id

parentRecordId

Id

Parent Record id which was passed in the wrapper

Success Response Example -:

[{"parentRecordId":"003fK0000047mLxQAI","paymentTransactionId":"a0CfK00001CLbmvUAD","statusCode":"200","paymentStatus":"Accepted","transactionid":"37883307","isSuccess":true}]

Failed Response Example -:

[{"parentRecordId":"003fK0000047mLxQAI","paymentTransactionId":"a0CfK00001CLP5JUAX","errorMessage":"Exception while capturing payment : Missing FirstName/LastName","paymentStatus":"Failed","isSuccess":false}]

Generate Payment Link

This automation generates a hosted payment link that can be emailed to the customer for self-service payment. It’s useful in cases where agents or sales reps want to initiate payments without directly capturing sensitive data. The customer opens the link, enters their card or bank details, and completes the transaction.

Use this when:
✅ You want the customer to initiate payment themselves.
✅ You prefer sending a secure hosted link via email.
✅ You support one-time payments via Card or ACH.

2.1 Wrapper Fields

Field Name

Description

Required

Possible Values / Notes

recordId

ID of the Parent Record to which the Payment Transaction will be linked

✅ Yes

Must be a valid Salesforce Record ID

paymentGatewayId

ID of the Payment Gateway record

✅ Yes

Must be a valid Payment Gateway record ID

amount

Amount (up to 4 decimal places)

✅ Yes

Example: 12, 12.12, 12.2345

fullName

Full name of the recipient

✅ Yes

Example: Test User

sEmail

Email address of the recipient who will receive the payment link.

✅ Yes

Example: test@test.com

linkHeader

Title which will be written on the payment page.

❌ Optional

Example: Invoice No-123

sLinkDescription

Description which can be written on payment page like product/service information.

❌ Optional

Example: Product 1

sFileContentDocumentId

Document Id for the document or invoice that will be send in the mail as an attachment

❌ Optional

Type: Salesforce Content document id

skipAutoTriggeredEmail

Automatically send email or not

❌ Optional

Default: true

sEmailTemplateName

Which email classic template to use

❌ Optional

Type: String

dDueDate

After how many days the link should get expired

❌ Optional

Default: Picked up from metadata if not passed

isRecurring

To set recurring payment

❌ Optional

Default: false

isSchedulePayment

True when the payment should be capture in future

❌ Optional

Default: false

scheduleDate

Date to schedule the payment. Defaults to the current date if not provided

❌ Optional

Format: YYYY-MM-DD

endDate

Date on which the recurring payment should stop.

❌ Optional

Format: YYYY-MM-DD

paymentFrequency

Frequency for recurring payment.

❌ Optional

Example: Weekly, Bi-Weekly, Monthly, Quarterly, Half-yearly, Annually

sendSms

If true, sends the payment request via SMS

❌ Optional

true / false

isSameDayTransaction

To process the transaction on same day pass it as true.

❌ Optional

Default: false
Depends on whether you gateway supports same day transaction.

Example:

InvocableGeneratePaymentLink.PaymentRequestWrapper oWrapper = new 
InvocableGeneratePaymentLink.PaymentRequestWrapper();
oWrapper.recordId = '0035e00001Fd3QqAAJ';
oWrapper.paymentGatewayId = 'a005e00000PzXIqAAN';
oWrapper.amount = 22.56;
oWrapper.sEmail = 'kunal.dk35@gmail.com';
oWrapper.fullName = 'Kunal Dhand';
InvocableGeneratePaymentLink.requestPayment(new List<InvocableGeneratePaymentLink.PaymentRequestWrapper>{oWrapper});

2.1 Response

Response is a serialize Map. It has below attributes:

Field Name

Type

Description

isSuccess

Boolean

Tells whether the process was success or not

paymentLink

String

Payment link which will be used to complete the payment

paymentStatus

String

Current Payment Status.

isRecurring

Boolean

Tells whether the payment is recurring or not

isScheduled

Boolean

Tells whether the payment is scheduled for the future

errorMessage

String

Error Details if any error comes while processing the payment

paymentTransactionId

Id

Payment Transaction record Id

parentRecordId

Id

Parent Record id which was passed in the wrapper

Response Example -:

[{"scheduledDate":"2025-10-29","isScheduled":true,"isRecurring":false,"paymentLink":"https://cm-sfqbconnector-dev-ed.develop.my.salesforce-sites.com/quickbooks/cm_finance__externalPaymentProcessVFPage?paymentData=EMOqzZntvE4vvMJjlVIVxhtZW4pc09Kwz6Wd5WK4N%2BhfZMUnGoM0T%2Bx13oy7aSywEbdxSumS39rLPdZtdl5pdZxREFUqUlHLSj1uBfKshtc%3D&gatewayId=a09fK000003QyQDQA0","parentRecordId":"003fK0000047mLxQAI","paymentTransactionId":"a0CfK00001D0u6RUAR","paymentStatus":"Open","isSuccess":true}]



3. Automate Payment with existing Payment Method

Automate Payment with Payment Method

This automation charges a payment method that has already been saved to a record, such as a previously used card or bank account. This is useful for businesses that store payment methods for repeat customers and want to trigger a charge programmatically without user input.

Use this when:
✅ The customer has a saved payment method.
✅ You want to automate recurring or repeat payments.
✅ Manual input of payment details is not required.

InvocableAutomatePaymentProcess.PaymentRequestWrapper oWrapper = new  InvocableAutomatePaymentProcess.PaymentRequestWrapper();
oWrapper.name = 'card';
oWrapper.recordId = '003fK0000047mLxQAI';
oWrapper.gatewayId = 'a09fK000001vpBhQAI';
oWrapper.amount = 1.0;
oWrapper.scheduleDate = Date.today();
oWrapper.paymentMethodId = 'a09fK000001vpBhQAI';
InvocableAutomatePaymentProcess.automatePayment(new List<InvocableAutomatePaymentProcess.PaymentRequestWrapper>{oWrapper});

4. Automate sending Funds

Sending Funds

This automation enables outbound payments or disbursements using saved or provided bank details. It is especially useful for scenarios such as issuing payouts, reimbursements, loan disbursements where the business is sending funds instead of collecting them.

Use this when:
✅ You want to send money to a bank account.
✅ The use case involves refunds, payouts, or vendor disbursements.
✅ You are using a gateway (e.g., UnityFi) that supports outbound payments.

InvocableFundingProcess.FundingRequestWrapper oWrapper = new InvocableFundingProcess.FundingRequestWrapper();
oWrapper.gatewayId = 'a09fK000001vpBhQAI';
oWrapper.recordId = '003fK000003NU2HQAW';
oWrapper.firstName = 'firstName';
oWrapper.lastName = 'lastName';
oWrapper.accountNumber = '1234567';
oWrapper.routingNumber = '123456780';
oWrapper.accountName = 'firstName lastName';
oWrapper.paymentMode = 'Savings';
oWrapper.amount = 1.0000;
InvocableFundingProcess.automateFunding(new List<InvocableFundingProcess.FundingRequestWrapper>{oWrapper});

Response Example -:

[{"parentRecordId":"003fK00000BVwrFQAT","paymentTransactionId":"a0CfK00001D1DUUUA3","statusCode":"200","paymentStatus":"Accepted","transactionid":"38095308","isSuccess":true}]

5. Automate Refund