FinDock Payment API (v1 [OLD])
NOTE: This reference describes an integration with the v1 of the API. Ongoing development on this version has stopped. Please use our new and improved API v2!
The FinDock Payment API is a REST API used to initiate online transactions and/or submit recurring payments to the FinDock application residing in a Salesforce Org. The API aims to abstract away both Salesforce and FinDock configuration details for specific payment processors and methods. The API instead provides several informational resources to retrieve environment-specific parameters of a particular Salesforce implementation.
If you are just starting to work with the API, please see our Getting started with the Payment API article!
Since our API is created for Salesforce implementations, there are some Salesforce-specific things to take into account.
Alongside the primitive datatypes such as String
, the Payment API uses several datatypes that might be unknown to you if you are not familiar with Salesforce or the Force.com platform.
The data types that are only applied in Salesforce contexts are Salesforce Objects (sObjects) and Record Types and custom fields.
sObjects
sObjects are objects that can be stored in the Force.com platform database, and they are representations of data that persists in the Salesforce database.
Some API resources accept, or even require, sObjects. The Payer
object, for example, requires sObjects such as Contact
and Account
.
The API allows you to define these objects in requests, as shown below, where both a Contact
and an Account
sObject are defined.
FinDock objects like PaymentProfile
can be used in the same way, but require you to specify the fields as custom fields.
Example body of a request for creating a Contact and an Account sObject
{
"SuccessURL":"http://success.com",
"FailureURL":"http://failure.com",
"Payer":{
"Contact":{
"FirstName":"Eric",
"LastName":"Johnson",
"Email":"eric@johnson.com",
"MailingStreet":"Rocket Rd",
"MailingCity":"Hawthorne0",
"MailingPostalCode":"CA 90250",
"MobilePhone":"98989898"
},
"Account":{
"Name":"Johnson Family",
"Website":"www.spacex.com",
"BillingStreet":"Rocket Rd",
"BillingCity":"Hawthorne",
"BillingPostalCode":"CA 90250"
},
"AccountRecordTypeName":"Household",
"AccountUpdate":"Replace",
"ContactUpdate":"Replace",
"AllowDeduplication":true,
"PrimaryRelation":"Contact"
}
}
Record Types
Record types let Salesforce administrators offer different business processes, picklist values, and page layouts to different users.
Organizations can, for example, differentiate between Account
objects in Salesforce by assigning them either to the Record Type of Organization
or Household
.
This facilitates the application of different types of page layouts or possible field values based on what
Record Type an Account
is. Your Salesforce Administrator can tell you more about the Record Types used in the Salesforce org.
Custom Fields
Salesforce allows administrators to add custom fields to objects in Salesforce. These fields can be seen in the Salesforce Object Manager of the Salesforce org setup. The API allows you to send Salesforce custom fields, and their corresponding values, as attributes in requests to the API.
Custom fields for standard Salesforce objects like Contact
and Account
are passed with "__c" at the end.
For illustration, we have added the field TwitterHandle
to the Salesforce Contact
object.
TwitterHandle | TwitterHandle__c | Text(50)
{
"Payer":{
"Contact":{
"FirstName":"Eric",
"LastName":"Johnson",
"TwitterHandle__c": "@EricJohnsonSalesforce"
}
}
}
Custom fields for custom FinDock objects like Payment
and Recurring
are passed in a CustomFields
object.
{
"Payment":{
"Amount": 10.0,
"CustomFields": {
"Sales_Invoice__c": "a506E0000009TfL"
}
}
}
Authentication is accomplished through an Oauth2.0 authorization flow. Each Salesforce environment requires its own token. A refresh token can be used to acquire a new access token if the current token has expired.
Read more on how to authenticate to Salesforce in the Salesforce developer guide.
Both client_secret
and client_secret
can be acquired from the Salesforce 'Setup' from a 'Connected App'.
- The
Authorization
token can be passed as a Bearer token in the request Header. - To Acquire a new
Authorization
token with the returnedRefresh
token, please make sure to pass the rightgrant_type
,client_id
,client_secret
andrefresh_token
as specified in the Salesforce documentation referenced above. To get up and running quickly, use the (unofficial-but-provided-by) Salesforce Postman Collection, as explained in this blog and look for the 'auth' folder.
The API always returns the status 200
, with a ResponseCode
and an IsSuccess
in the body. When IsSuccess
= false
, an Error
object is returned.
Example of a successful request (to the SourceConnector Provisioning API):
{
"ResponseCode": "001",
"IsSuccess": true,
"SourceConnectors": [
{
"Slug": "PaymentHub",
"Name": "PaymentHub",
"IsDefault": false
}
]
}
Example of an error that is returned whenever an incorrect request is sent:
{
"ResponseCode": "999",
"IsSuccess": false,
"Error": {
"error_message": "Contact error: Required fields are missing: [LastName]",
"error_code": "999"
}
}
Full list of possible response codes:
ResponseCode | Description |
---|---|
001 | The request is processed successfully |
010 | Malformed request: missing one or more mandatory core parameter(s) |
011 | Malformed request: missing one or more mandatory Payment Processor parameters |
012 | Malformed request: missing one or more mandatory SourceConnector parameters |
020 | Invalid data: the supplied data is incorrect (e.g. an invalid e-mail address) |
030 | Deduplication error: the request failed because a deduplication rule prevented record creation and/or an update |
040 | Invalid API token provided |
098 | An object is missing and no default is specified |
999 | Error without specific category: consult the error_message for details |
For more information on errors and response codes and debugging the API, please read our Troubleshooting the Payment API article.
To receive updates on a created Payment with the /Payments
endpoint, you can pass an endpoint URL in the WebhookURL
parameter in the request body.
If the status
of the Payment (Installment record in Salesforce) changes, either by an update from a PSP or manually, you will receive a notification with the following body.
The message contains the id
, status
, amount
and other data of the original Payment request, as well as actual performed Payments related to the request.
To allow webhook notifications to be sent from FinDock, you need to add your URL to the Remote Site Setting of the Salesforce environment.
{
"Url": "/services/data/v36.0/sobjects/Installment__c/a083E00000AG04mQAD",
"Type": "Installment__c",
"Id": "a083E00000AG04mQAD",
"Target": "Target Name 1",
"Status": "Collected",
"Payments": [
{
"Url": "/services/data/v36.0/sobjects/Payment__c/a0R3E000008WvL9UAK",
"Type": "Payment__c",
"Id": "a0R3E000008WvL9UAK",
"Target": "Target Name 1",
"PaymentProcessor": "PaymentHub-Mollie",
"PaymentMethod": "ideal",
"CollectionDate": "2020-03-26",
"Amount": 100
}
],
"PaymentProcessor":"PaymentHub-Mollie",
"PaymentMethod": "ideal",
"Amount": 100
}
Informational resource that returns a list of all available and active payment methods, and the active processors that have those payment methods enabled. Payment Methods range from Direct Debit, to Credit Card and various Online payments through Payment Service Providers (PSPs).
Name | string The name of the Payment Method, e.g. |
Array of objects (Processor) [ items ] Which Payment Processors can be used to perform payments with this Payment Method. | |
SupportsRecurring | boolean Whether the Payment Method supports recurring payments. |
Array of objects (Parameter) [ items ] Additional parameters required to perform a payment with this Payment Method. | |
PaymentProfile | object (PaymentProfile) The Payment Profile contains the financial details of the Contact or Account, that are required to perform a certain payment through the API, e.g. the Bank Account or a BACS Sort code. Whether a Payment Profile is required and what parameters should be passed can be found in our Payment Extension documentation. |
{- "Name": "DirectDebit",
- "Processors": [
- {
- "Name": "PaymentHub-SEPA",
- "PaymentMethods": "DirectDebit",
- "IsDefault": true,
- "Targets": [
- {
- "Name": "PRIMARY-BANK-ACCOUNT",
- "GlobalTarget": "PaymentHub-SEPA"
}
], - "Parameters": [
- {
- "Required": true,
- "Name": "PAYMENT_PROFILE",
- "Description": "The payment profile object contains card or bank information.",
- "DataType": "Id"
}
], - "SupportsRecurring": false,
- "RequiresAuthorization": true
}
], - "SupportsRecurring": true,
- "Parameters": [
- {
- "Required": true,
- "Name": "PAYMENT_PROFILE",
- "Description": "The payment profile object contains card or bank information.",
- "DataType": "Id"
}
], - "PaymentProfile": {
- "cpm__Bank__Account__c": "93465581",
- "paybacs__Sort_Code__c": "001234"
}
}
Retrieve Payment Methods
Return a list of payment methods configured in the Salesforce environment and related Payment Processors.
Responses
Response samples
- 200
{- "ResponseCode": "001",
- "IsSuccess": true,
- "PaymentMethods": {
- "Name": "DirectDebit",
- "SupportsRecurring": true,
- "Parameters": [
- {
- "Required": true,
- "Name": "PAYMENT_PROFILE",
- "Description": "The payment profile object contains card or bank information.",
- "DataType": "Id"
}
], - "Processors": [
- {
- "SupportsRecurring": false,
- "RequiresAuthorization": true,
- "Parameters": [
- {
- "Required": true,
- "Name": "PAYMENT_PROFILE",
- "Description": "The payment profile object contains card or bank information.",
- "DataType": "Id"
}
], - "Name": "PaymentHub-SEPA",
- "PaymentMethods": "DirectDebit",
- "Target": [
- {
- "Name": "PRIMARY-BANK-ACCOUNT",
- "GlobalTarget": "PaymentHub-SEPA"
}
]
}
]
}
}
Informational resource that returns a list of all available and active payment processors that can be used to perform a payment, and the active payment methods which they support. A payment processor 'processes' the payment. Some Payment Processors require additional parameters to be passed. The API returns these with instructions in the 'Parameters' block in the response.
Name | string The name of the Payment Processor. |
Array of objects (PaymentMethod) [ items ] Which Payment Methods the Payment Processor supports. | |
IsDefault | boolean Whether this is the default Payment Processor. If no Payment Processor is passed in the request, this Processor will be used to process the payment. |
Array of objects (Target) [ items ] All Targets that have been configured for this specific Payment Processor. | |
Array of objects (Parameter) [ items ] Additional parameters that are required to perform a payment through this Payment Processor. | |
SupportsRecurring | boolean Whether the Payment Processor supports recurring payments. |
RequiresAuthorization | boolean Whether this Payment Processor requires an initial transaction (Payment object) in a recurring payment request. |
{- "Name": "PaymentHub-SEPA",
- "PaymentMethods": "DirectDebit",
- "IsDefault": true,
- "Targets": [
- {
- "Name": "PRIMARY-BANK-ACCOUNT",
- "GlobalTarget": "PaymentHub-SEPA"
}
], - "Parameters": [
- {
- "Required": true,
- "Name": "PAYMENT_PROFILE",
- "Description": "The payment profile object contains card or bank information.",
- "DataType": "Id"
}
], - "SupportsRecurring": false,
- "RequiresAuthorization": true
}
Retrieve Payment Processors.
Return a list of payment processors configured in the Salesforce environment and related Payment Methods.
Responses
Response samples
- 200
{- "ResponseCode": "001",
- "IsSuccess": true,
- "Processors": [
- {
- "SupportsRecurring": false,
- "RequiresAuthorization": true,
- "Parameters": [
- {
- "Required": true,
- "Name": "PAYMENT_PROFILE",
- "Description": "The payment profile object contains card or bank information.",
- "DataType": "Id"
}
], - "Name": "PaymentHub-SEPA",
- "PaymentMethods": "DirectDebit",
- "Target": [
- {
- "Name": "PRIMARY-BANK-ACCOUNT",
- "GlobalTarget": "PaymentHub-SEPA"
}
]
}
]
}
Informational resource that returns the source connector used in a specific Salesforce environement. A source connector represents an application in Salesforce that will be used to ultimately store the transaction that is being initiated through the Payment API.
Name | string The name of the Source Connector that will be used to register recurring payments and amounts receivable in Installments. e.g. 'PaymentHub', 'NPSP'. For a full list of available Source Connectors, visit the Source Connectors documentation. |
Slug | string The shortname of the source package. |
IsDefault | boolean Whether this is the default Source Connector. If no Source Connector is passed in the request, this Source Connector is used. |
{- "Name": "PaymentHub",
- "Slug": "PaymentHub",
- "IsDefault": "true"
}
Retrieve Source Connectors.
Return a list of Source Connectors configured in the Salesforce environment.
Responses
Response samples
- 200
{- "ResponseCode": "001",
- "IsSuccess": true,
- "SourceConnectors": [
- {
- "Slug": "PaymentHub",
- "Name": "PaymentHub",
- "IsDefault": "true"
}
]
}
Informational resource that returns the package actions possible and/or required for a certain Salesforce environment. Package actions are additional actions that can be performed for a specific FinDock Extension, like a payment extension or source connector. Package Actions can be used to perform additional actions in Salesforce through FinDock while making a Payment Request, like creating a record.
If a Payment Methods or Source Connector has a Package Action, these can be found in the specific Extension or Source Connector extension is an example of such a package.
PackageName | string The name of the SourceConnector/Package for which the action is to be performed. |
object List of actions that can be performed. |
{- "PackageName": "PaymentHub-GiftAid",
- "actions": {
- "name": "CreateGiftAidDeclaration",
- "Parameters": [
- {
- "Required": true,
- "Name": "PAYMENT_PROFILE",
- "Description": "The payment profile object contains card or bank information.",
- "DataType": "Id"
}
]
}
}
Retrieve Package Actions.
Return a list of possible Package Actions for a specific Salesforce environment.
Responses
Response samples
- 200
{- "ResponseCode": "001",
- "IsSuccess": true,
- "PackageActions": [
- {
- "PackageName": "PaymentHub-GiftAid",
- "actions": {
- "name": "CreateGiftAidDeclaration",
- "Parameters": [
- {
- "Required": true,
- "Name": "PAYMENT_PROFILE",
- "Description": "The payment profile object contains card or bank information.",
- "DataType": "Id"
}
]
}
}
]
}
The /Payments
endpoint allows for Payments to be made through a configured Salesforce environment and updates Salesforce data accordingly.
The Payment API requires a 'Payment Method', 'Payment Processor' and 'Source Connector' to perform a successful request. The available Payment Method, Processors and Source Connectors for a specific Salesforce environment can be queried through their specific endpoints. Some Payment Methods enable or require further Package Actions. Be sure to include these in the request.
It is also possible to perform Payments on existing Installments.
object (Payer) Data on the paying party. Can be an existing or new | |
object (Payment) Data on new or existing Single Payment. | |
object (Recurring) Data on new Recurring Payment. | |
object (PaymentMethod) Data on how the Payment will be performed. Includes a.o. the Payment Method, Payment Processor, Target and additional Parameters required to perform the Payment. | |
object (SourceConnector) Source Connector to be used to process the data in Salesforce. | |
Array of objects (PackageAction) [ items ] A list of additional actions to be performed when making this request. More information about Package Actions can - if available - be found in our Extension and Source Connector documentation. |
{- "Payer": {
- "Contact": {
- "Id": "a0P3X00000WjR8AUAV",
- "RecordTypeName": "Donor",
- "FirstName": "Eric",
- "LastName": "Johnson",
- "Email": "test@findock.com",
- "MailingStreet": "Rocket Rd",
- "MailingCity": "string",
- "MailingPostalCode": "CA 90250",
- "MobilePhone": "98989898"
}, - "ContactId": "a0P3X00000WjR8AUAV",
- "ContactRecordTypeName": "Donor",
- "ContactUpdate": "Enrich",
- "Account": {
- "Id": "a0P3X00000WjR8AUAV",
- "Name": "Johnson Family",
- "BillingStreet": "Rocket Rd",
- "BillingCity": "Hawthorne",
- "BillingPostalCode": "CA 90250",
- "RecordTypeName": "Household"
}, - "AccountId": "a0P3X00000WjR8AUAV",
- "AccountRecordTypeName": "Household",
- "AccountUpdate": "Enrich",
- "AllowDeduplication": true,
- "ContactDeduplicated": false,
- "AccountDeduplicated": false,
- "PrimaryRelation": "Contact",
- "IgnoreAccount": false
}, - "Payment": {
- "Status": "Outstanding",
- "InstallmentId": "a083X00001aUMCnQAO",
- "Amount": 10,
- "CurrencyISOCode": "string",
- "RecordTypeName": "string",
- "CustomFields": {
- "soco__Destination_lookup__c": "a070Y000005M7t6",
- "soco__Originating_Campaign__c": "7010Y000000dDSQ"
}
}, - "Recurring": {
- "Id": "string",
- "Amount": 10,
- "CurrencyISOCode": "EUR",
- "Frequency": "Monthly",
- "RecordTypeName": "string",
- "StartDate": "2020-01-01",
- "EndDate": "2021-01-01",
- "CustomFields": {
- "soco__Destination_lookup__c": "a070Y000005M7t6",
- "soco__Originating_Campaign__c": "7010Y000000dDSQ"
}
}, - "PaymentMethod": {
- "Name": "DirectDebit",
- "Processors": [
- {
- "Name": "PaymentHub-SEPA",
- "PaymentMethods": "DirectDebit",
- "IsDefault": true,
- "Targets": [
- {
- "Name": "PRIMARY-BANK-ACCOUNT",
- "GlobalTarget": "PaymentHub-SEPA"
}
], - "Parameters": [
- {
- "Required": true,
- "Name": "PAYMENT_PROFILE",
- "Description": "The payment profile object contains card or bank information.",
- "DataType": "Id"
}
], - "SupportsRecurring": false,
- "RequiresAuthorization": true
}
], - "SupportsRecurring": true,
- "Parameters": [
- {
- "Required": true,
- "Name": "PAYMENT_PROFILE",
- "Description": "The payment profile object contains card or bank information.",
- "DataType": "Id"
}
], - "PaymentProfile": {
- "cpm__Bank__Account__c": "93465581",
- "paybacs__Sort_Code__c": "001234"
}
}, - "SourceConnector": {
- "Name": "PaymentHub",
- "Slug": "PaymentHub",
- "IsDefault": "true"
}, - "PackageActions": [
- {
- "PackageName": "PaymentHub-GiftAid",
- "actions": {
- "name": "CreateGiftAidDeclaration",
- "Parameters": [
- {
- "Required": true,
- "Name": "PAYMENT_PROFILE",
- "Description": "The payment profile object contains card or bank information.",
- "DataType": "Id"
}
]
}
}
]
}
Retrieve Payment Status
Returns the status of a specific payment. This can only be used to request the status of a one-off transaction. Recurring transactions are not supported.
path Parameters
ID required | string The unique GUID or Salesforce ID of the 'Installment' to retrieve. |
Responses
Response samples
- 200
{- "ResponseCode": "001",
- "IsSuccess": true,
- "Payment": {
- "Status": "Outstanding",
- "InstallmentId": "a083X00001aUMCnQAO",
- "Amount": 10,
- "CurrencyISOCode": "string",
- "RecordTypeName": "string"
}
}
Create or update a single or recurring payment
The FinDock Payment API supports both one-time and recurring payments. To perform recurring payments, a 'Recurring' block replaces the 'Payment' block in the request. Some Payment Service Providers (PSPs) require an initial payment AND recurring payment in the same request for authorization of the transaction. You can find out whether this is the case for a specific Payment Processor through the GET /PaymentMethod and GET /PaymentProcessors endpoints. Please see the specific Payment Extension documentation on the details of performing a one-time and/or recurring payment. To perform payments on an existing Installment, simply remove the Payer block and add the InstallmentId to the Payment block.
Request Body schema: application/json
SuccessURL required | string <url> (SuccessURL) The URL the user will be redirected to when a transaction has been completed successfully. |
FailureURL required | string <url> (FailureURL) The URL the user will be redirected to when a transaction has failed or has been cancelled. |
WebhookURL | string <url> (WebhookURL) URL where you want to receive notifications on the status of the Payment request on. More information on the Webhook can be found here. |
Origin | string (Origin) Originating source of the API call. This can be used to add for instance a channel or an id. |
required | object (PayerRequest) Data on new or existing Single Payment. If an |
object (NewPaymentRequest) Data on NEW Payment. | |
object (PaymentMethodRequest) Data on how the Payment will be performed. | |
object (SourceConnectorRequest) Source Connector to be used to process the data in Salesforce. | |
object (PackageActionRequest) PackageAction object that specifies which additional actions need to be performed in Salesforce. |
Responses
Request samples
- Payload
{- "SuccessURL": "www.success.nl",
- "FailureURL": "www.failure.nl",
- "WebhookURL": "www.findock.com/api/endpoint",
- "Origin": "Webform",
- "Payer": {
- "Contact": {
- "FirstName": "Eric",
- "LastName": "Johnson",
- "Email": "test@findock.com"
}, - "ContactId": "a0P3X00000WjR8AUAV",
- "ContactRecordTypeName": "Donor",
- "ContactUpdate": "Enrich",
- "AccountId": "a0P3X00000WjR8AUAV",
- "Account": {
- "Name": "Johnson Family",
- "BillingStreet": "Rocket Rd",
- "BillingCity": "Hawthorne"
}, - "AccountRecordTypeName": "Household",
- "AccountUpdate": "Enrich",
- "AllowDeduplication": true,
- "PrimaryRelation": "Contact"
}, - "Payment": {
- "Amount": 10,
- "CurrencyISOCode": "string",
- "CustomFields": {
- "soco__Destination_lookup__c": "a070Y000005M7t6",
- "soco__Originating_Campaign__c": "7010Y000000dDSQ"
}
}, - "PaymentMethod": {
- "Name": "DirectDebit",
- "Processor": "PaymentHub-SEPA",
- "Target": "PRIMARY-BANK-ACCOUNT",
- "ParameterMap": {
- "IBAN": "NL69INGB0123456789",
- "Preferred Language": "Dutch"
}, - "PaymentProfile": {
- "cpm__Bank__Account__c": "93465581",
- "paybacs__Sort_Code__c": "001234"
}
}, - "SourceConnector": {
- "Name": "PaymentHub"
}, - "PackageActions": {
- "PaymentHub-GiftAid": {
- "CreateGiftAidDeclaration": {
- "dateMade": "2019-11-15",
- "startDate": "2020-01-01",
- "endDate": "2020-12-31",
- "firstName": "J",
- "lastName": "Fletcher",
- "houseNameOrNumber": "12",
- "postalCode": "L68 0AQ",
- "overseas": true,
- "acquisitionMethod": "Oral"
}
}
}
}
Response samples
- 200
{- "ResponseCode": "001",
- "IsSuccess": true,
- "Payer": {
- "ContactId": "a0P3X00000WjR8AUAV",
- "AccountId": "a0P3X00000WjR8AUAV",
- "ContactDeduplicated": false,
- "AccountDeduplicated": false
}, - "Payment": {
- "InstallmentId": "a083X00001aUMCnQAO"
}, - "PaymentMethod": {
- "Name": "DirectDebit",
- "Processor": "PaymentHub-SEPA",
- "Target": "PRIMARY-BANK-ACCOUNT"
}, - "SourceConnector": "PaymentHub",
}