Migrating from API v1 to API v2
END-OF-LIFE ANNOUNCEMENT The Classic Online Experience with Payment API version 1 will be decommissioned at the end of 2024. All Payment API integrations should migrate to version 2, the Enhanced Online Experience, by January 2025.
With the FinDock July 2020 release, version 2 of the Payment API was introduced. This new version of the Payment API provides significant benefits in performance, ease-of-integration and functionality. Active development of new features on version 1 stopped with the July 2020 release.
To find out the high-level differences between API v1 and API v2, please visit our How does the Customer Payment API work?.
Detailed information about the API v1 and API v2 can be found in the API reference:
Breaking changes & new functionality
The API v2 introduces breaking changes to the following components:
- Renamed
/Payment
endpoint to/PaymentIntent
to clarify that aPOST
request to this endpoint creates anInbound Report
record, from which anInstallment
orRecurring
record is created through Guided Matching, instead of aPayment
record in Salesforce. AGET
request on/PaymentIntent
returns aPaymentIntent
(Inbound Report) object with relatedInstallment
and/orRecurring
&Payment
records.Payment
records are created from callbacks from Payment Service Providers. - Removed redundant
/Processors
endpoint: the same data is available through the/PaymentMethods
endpoints. - Changed body / definition of the
/PaymentIntent
request to FinDock:- The
Payment
object has been renamed toOneTime
to better reflect the resulting data in Salesforce. - All parameters that are only used to persist data in Salesforce, without triggering logic in the API, have been moved to a
SalesforceFields
object.- This object takes any value for a Salesforce Standard or Custom Field is copied to the created record in Salesforce
- The
SalesforceFields
object is available in theRoot
of the request, the sub-objects ofPayer
(Contact & Account) and the OneTime (Installment) & Recurring objects. SalesforceFields added to theRoot
of the request will be persistent on the Inbound Report object.
- The
- Changed body / definition of the
/PaymentIntent
response from FinDock has changed:- A
POST
on/PaymentIntent
no longer returns aPayment
orPayer
object, since the creation of Salesforce data likeContact
.Installment
andOpportunity
are now handled asynchronously. Once theInstallment
has been created, you will receive a Webhook on “Installment status change” if you have added aWebhookURL
variable.
NOTE: Please make sure your callback url endpoint is added to the Salesforce Remote Site Settings, to allow traffic from Salesforce to the endpoint. - A
GET
on/PaymentIntent
now returns anPaymentIntent
object withInstallment
orRecurring
object with relatedPayments
similar to the Webhook on “Installment status change” - The body of the Webhook on “Installment status change” is unchanged.
- A
- Split HTTP Status Codes: FinDock no longer always returns
200
on every API call. If an error occurs, FinDock will return a4xx
or5xx
status code with a more detailedResponseCode
anderrorMessage
.- This change has made the
IsSuccess
parameter redundant and it has thus been removed. - A
200
response now means the Inbound Report was created successfully in Salesforce and FinDock was able to return a response. However:- The complete payment flow may still fail upon redirection to the PSP, even though we try to do as much validation on the initial call to the API. Please handle these errors as well.
- The further creation of data in Salesforce by Guided Matching from the Inbound Report may still fail on Validation Rules and Customization in Salesforce. Please make sure the proper checks and Guided Review processes are set up.
- This change has made the
- Changed Error response:
- API now returns an array of errors
- Removed redundant
ResponseCode
parameter fromError
object
- Renamed & Changed
ParameterMap
object:- Changed name to
Parameters
in both theGET
/PaymentMethod
response and thePOST
/PaymentIntent
request where the optional and required parameters for all Payment Methods in a Salesforce org can be requested and used. - Added
Enum
parameter to theGET
/PaymentMethod
response in case only a limited amount of (picklist) values is allowed. Example: iDeal Issuer. - Removed
AuthorizationRequired
parameter. - Changed specific Parameters per PSP. Please see migration steps for specifics.
- Changed name to
- Changed
PaymentMethod
object:- Removed
PaymentProfile
from definition. Fields that were part of the Payment Profile will be added to the Parameter object. This is implemented per Payment Service Provider. - Removed SourceConnector object and Added Settings object to store Salesforce data processing parameters like SourceConnector.
- Added a new parameter
ProcessingType
which sets the SubType of Inbound Report. This SubType can be used to apply different Guided Matching rulesets to different API calls.
- Removed
- Removed the ability to perform Unauthenticated (to Salesforce) calls with just a FinDock API Token. Please use Salesforce Authentication with your API calls. More information on Authentication can be found in the API Reference.
- Removed ability to pass a
RecurringId
in a/PaymentIntent
request. - Removed Account & Contact processing settings from API to Guided Matching: parameters with regards to deduplication, update/create of records & primary relation were removed from the API. These settings can now be configured in your Salesforce orgs Guided Matching setup.
- Introduced
idempotency
key parameter (optional): a unique identifier can be passed in the API to ensure the same transaction is not executed twice. This way you can safely retry an API call without creating duplicate payments.
Migration steps
The migration script below covers a basic implementation of the FinDock Customer Payment API. Customization to handle Salesforce Org specific configuration and customization and integration with 3rd party systems is not covered and will need to be migrated by the developing party.
On the Salesforce side
The API v2 creates the same Salesforce data as the API v1. The API v2 does however require a connection with the new WebHub to function:
- The handling of notifications from Payment Service Providers will be done through the Notification Gateway which is part of the WebHub. For more information, see Configuring WebHub and Notification Gateway
- Because the creation of Salesforce data is now handled asynchronously, when the data is created has however changed. Data creation is done based on
Messages
records that are queued and ordered by creation date to prevent conflicts. From theseMessages
records FinDock createsInbound Report
records that are handled through Guided Matching. No action is required to make this work, once the WebHub is set up. - Configure Guided Matching rules with regards to Account & Contact creation, update & deduplication if required for your business case. You can leave these as-is if the default handling suits your requirements. Please read our Processing and reconciling online payments article for more details.
On the API side
- Change your base URLs from
/services/apexrest/cpm/v1.0/
to/services/apexrest/cpm/v2/
- If you were using the API Unauthenticated (with just a FinDock API token from the FinDock setup), please implement Authentication through Salesforce.
- Change
PaymentMethod
response handling: incorporate the newEnum
field in your logic if relevant to your use case. - Change all API calls referencing
/Payment
to/PaymentIntent
- Change the
/PaymentIntent
request body:- Add a
Settings
object to the root of the request body. - Remove the
SourceConnector
object and add a parameterSourceConnector
to the newSettings
object in theroot
of the request. - Rename
Payment
object toOneTime
. - Add all
Contact
andAccount
fields except forRecordTypeName
to aSalesforceFields
object underContact
and / orAccount
. - Remove Relationship parameters:
AccountUpdate
&ContactUpdate
PrimaryRelation
IgnoreAccount
- Rename the
ParameterMap
object inPaymentMethod
toParameters
- Add an idempotency key (optional)
- PSP specific changes to parameters: to be added when a PSP is refactored
- Add a
- Change
PaymentIntent
response handling:- Remove references to the
IsSuccess
parameter and base your logic on the HTTP Status Code, where 200 = Success and 4xx and 5xx = Failed - Change your handling of HTTP Status Codes to account for
4xx
and5xx
responses on error scenarios. - Handle errors as array
- Remove usage of ResponseCode parameter and replace with ErrorCode parameter.
- If you are using the returned
InstallmentId
from thePOST
/Payment
response, please implement the Webhook on “Installment status change” to handle your business logic.
- Remove references to the
Testing
We advise you to at minimum test the following:
- Creating a new one-time & recurring payment
- Updating an existing one-time payment (Installment)
- Installment, Recurring & Payment records created in Salesforce through the API. The resulting data should be the same as when using API v1.
- Webhooks sent to your WebhookURL if applicable.