Class Library & Invocable Methods

The SmarterPay for Salesforce package provides a comprehensive set of global classes that help with creating records, processing API/Webhook queues and communicating directly with SmarterPay Cloud.

A series of Invocable methods and Service classes are provided in the package to enable simple interface with the SmarterPay Cloud API. These can not only be used from Apex code within Salesforce, but also from Flows or even external calls using the Salesforce REST API.

Invocable methods will create the records directly in SmarterPay Cloud, the corresponding Salesforce records are created upon receipt of the webhook from SmarterPay Cloud. Values can be included in the metadata to enable lookups to the corresponding Account and Contact (or Custom object) for the record.

Invocable Method
Bank Account
Mandate



Bank Account

Action: Create or Update a Bank Account.
URL: /services/data/v56.0/actions/custom/apex/SmarterPay__InvocableUpsertBankAccount
Apex Class: InvocableUpsertBankAccount.Invocable_UpsertBankAccount

Used to create or update a bank account via the SmarterPay Cloud API.

Example Request:

{
  "inputs": [
    {
      "SortCode": "200000",
      "CustomReference": "Example Reference",
      "AccountNumber": "55779911",
      "AccountName": "John Smith",
      "metadata": {
        "additionalFields": [
          {
            "fieldValue": "0052z00000569aOAAQ",
            "fieldAPIName": "SmarterPay__Contact__c"
          }
        ]
      }
    }
  ]
}

Example Repsonse:

[
  {
    "actionName": "SmarterPay__InvocableUpsertBankAccount",
    "errors": null,
    "isSuccess": true,
    "outputValues": {
      "BankAccountSMPCId": "BA01D1LRPM4YKGK8YEQG",
      "Error": false,
      "ErrorDetails": null
    }
  }
]


Mandate

Action: Create or Update a Mandate.
URL: /services/data/v56.0/actions/custom/apex/SmarterPay__InvocableUpsertMandate
Apex Class: InvocableUpsertMandate.Invocable_UpsertMandate

Used to create or update a Mandate via the SmarterPay Cloud API

Example Request:

{
  "inputs": [
    {
      "BankAccountSMPCId": "BA015D0G80XGDG1PERW4",
      "metadata": {
        "additionalFields": [
          {
            "fieldValue": "0033G00000G98YTQAZ",
            "fieldAPIName": "SmarterPay__Contact__c"
          }
        ]
      }
    }
  ]
}

Example Repsonse:

[
  {
    "actionName": "SmarterPay__InvocableUpsertMandate",
    "errors": null,
    "isSuccess": true,
    "outputValues": {
      "Error": false,
      "ErrorDetails": null,
      "MandateSMPCId": "M01G420EJ9G64ZP1VQW"
    }
  }
]
  • Last modified: 2024/01/08 11:57