If you use the LegalCollect payment gateway, you can add a “Pay Now” button directly to the PDF invoices Actionstep generates. Take the pain out of getting paid — before an invoice is ever overdue.
Don't wait for “overdue” to offer an easy way to pay.
Actionstep has a feature called Calculated Merge Fields that lets you (or your implementation partner) create custom merge fields for documents and emails. Two calculated merge fields power the Pay Now button.
Before you start, you'll need:
An advanced feature. Calculated Merge Fields are typically only available to Actionstep users with Admin access. If you don't have experience with Actionstep's merge fields or document assembly, ask your Actionstep implementation partner — or us — for assistance.
The first field determines the current amount due on an invoice, formatted without a dollar sign or thousand separator — important, because the amount is used as a parameter in an API call and must not include special characters.
Log in to Actionstep, navigate to Admin > Document Assembly, then click Merge Field List.
Click Add Calculated Field (top right) and set the Merge Field Name to SP_BalanceDueInvoice.
Copy the code below into the Calculation Code section, then click Save.
$A = (floatval(str_replace(array('$', ','), '', '[[SP_TotalInclusive]]')));
$B = (floatval(str_replace(array('$', ','), '', '[[SP_FeeDiscountAmount]]')));
$X = $A + $B;
$Y = (floatval(str_replace(array('$', ','), '', '[[SP_FeeDiscountAmount]]')));
$Z = (floatval(str_replace(array('$', ','), '', '[[SP_TrustTotalAppliedOnInvoiceCreatedDate]]')));
$calculation = $X - $Y - $Z;
echo '$' . number_format($calculation, 2);
Click Add Calculated Field again and set the Merge Field Name to LegalCollectPayNowLink.
Copy the code below into the Calculation Code section, then click Save.
Replace <<YOUR PAYMENT GATEWAY LINK GOES HERE>> with your payment gateway link from LegalCollect, found under Settings > Payment Gateway. It looks like https://actioncollect.app/paynow/ABCDEFGHI89=/ — the trailing string is your unique gateway key, so copy it exactly.
//Set the LegalCollect base URL from the Payment Gateway settings screen
$BaseURL = '<<YOUR PAYMENT GATEWAY LINK GOES HERE>>/';
//The invoice number of the ActionStep invoice
$INVNo = '[[SP_OurReference]]';
//Gets the amount of an invoice and removes the dollar sign and comma
$Amount = str_replace(["$",","], '', '[[SP_BalanceDueInvoice]]');
//Concatenates the variables to create the final URL
$LinkURL = $BaseURL . $INVNo . '/' . $Amount;
//Return the final URL
echo $LinkURL;
You can now use the new merge field in document and email templates — your invoice template being the most likely place. Insert the merge field for a plain link, or add an image for a proper “Pay Now” button:
Navigate to Admin > Document Assembly and download your invoice template.
Place your Pay Now button image where you want it on the invoice.
Right-click the button and set the link to the merge field name — <<LegalCollectPayNowLink>> if you used the recommended name.
Upload the document back to Actionstep to update your template. Done — every invoice now carries a payment button.
Every firm's templates differ. If you're not sure how to proceed, we recommend getting advice from your Actionstep implementation partner — or just ask us.
We can have the Pay Now button running on your invoices as part of onboarding — book a demo to see it in action.