How the Payment API works

The Payment API is a REST API used to initiate online payment transactions and/or submit recurring payments to the FinDock app in Salesforce. The API abstracts both Salesforce and FinDock configuration details for specific payment processors and methods, instead providing several informational resources to retrieve environment-specific parameters of a particular implementation.

API v2: From payer to collection

caution

Enhanced Online Experience (with API v2) will be in Beta from the October '20 release onwards.

Enhanced Online Payment Experience

Once the Payer has entered the data in the online form:

  1. Form sends a payment request or PaymentIntent to the FinDock Payment API
  2. FinDock validates the PaymentIntent and creates a Payment with the chosen Payment Service Provider (PSP)*
  3. FinDock and sends a response with a RedirectURL to the a PSP payment page back to the form.** FinDock also creates a Messages record in Salesforce through the WebHub with an Authorized user to store the request and handle data creation. In parallel (asynchronously) FinDock creates Salesforce data:
    • An Inbound Report is created from the Message created in step 2.
    • The Inbound Report is processed through Guided Matching to create data:
      • Create or update Contacts and/or Account records.
      • Create Installment and/or Recurring records, update Installment records
tip

The out-of-the-box Guided Matching rule set used to process the API call can be configured and extended. For more information, please read our Processing and Reconciling online payments article.

  1. Form redirects the Payer to the PSP payment page based on the RedirectURL:
    • Payer either completes or cancels the payment on the PSP Page
    • PSP page redirects Payer to Success or Failure Page provided in the initial payment request.
  2. PSP notifies FinDock Notification Gateway (WebHub) of the result of step 4.
  3. FinDock WebHub creates a Message record in Salesforce with the Salesforce API, from which an Inbound Report is created.
  4. The Inbound Report is processed through Guided Matching to create data and reconciled against the data created previously:
    • Creates a Payment record in Salesforce related to the Installment created at step 3.
    • Reduces the amount on the Installment with the amount of the Payment.
    • Updates the status of the Installment to Paid.

If the Payment was not completed the status of the Installment is updated to Failed. If you use a Source Package like NPSP, FinDock updates the data in this package.

*The following validations are performed on the request send to the Payment API:

  • Contains negative amounts
  • Contains not existing record types
  • Contains not existing targets
  • Recurring End Date < Recurring Start Date
  • OneTime required fields (Amount)
  • Recurring required fields (Amount, Frequency, StartDate)
  • Installment required fields (ID or GUID)
  • Does not have OneTime, Recurring or Installment section
  • Required parameter not provided
  • Parameter value not in enum
  • Payment method requires initial payment for recurring: Recurring and no OneTime sections available
  • Payment method does not require initial payment for recurring: Recurring and OneTime section available
  • Payment method does not supports recurring, but Recurring section available.
  • Installment section with a OneTime or Recurring section.

** For certain payment methods like direct debit and acceptgiro, steps 4-7 are not always required since the payment will be handled by sending files to and receiving files from your bank. These files can be generated from the data created through the API with Payment Schedules.

Next steps

Migrate from API v1 to API v2

Get started with the Payment API

Create one-off and recurring payments through the API

Read the details in the API Reference

API v1: From payer to collection

note

Even though v1 of the Payment API is still supported, we strongly recommend new implementations to use v2, and existing implementations to migrate to v2. The API v2 provides significant improvements in performance, ease-of-integration and functionality. Development of new features on v1 has stopped after the July 2020 release. To find out how to migrate, please visit our Classic to Enhanced Online Experience migration article.

Classic Online Payment Experience

Once the Payer has entered the data in the online form:

  1. Form sends a payment request or PaymentIntent to the FinDock Payment API.
  2. FinDock validates the payment request and creates a Payment with the chosen Payment Service Provider (PSP).
  3. FinDock creates a Messages record in Salesforce through an Authorized user to store the request and handles data creation:
    • Create or update Contacts and/or Account records.
    • Create Installment and/or Recurring records with status Pending
caution

ALL logic with regards to data creation in the Salesforce environment - like Deduplication rules, Process Builders, Apex code and data creation in Source Connectors like Salesforce NPSP- is triggered at this point, and handled before the API continues! Any (Salesforce) errors in this stage will break the API!

  1. FinDock builds a response with the created data.
  2. FinDock sends a response with a RedirectURL to the a FinDock VisualForce page back to the form.*
  3. Form redirects the Payer to the FinDock Redirect page based on the RedirectURL.
  4. FinDock Redirect page redirects Payer to the PSP payment page.
    • Payer either completes or cancels the payment on the PSP Page
    • PSP page redirects Payer to Success or Failure Page provided in the initial payment request.
  5. PSP notifies FinDock VisualForce page through a Salesforce site (with Salesforce Site Guest user of the result of step 7.
  6. FinDock creates a Message record to store the Notification and handles data creation:
    • Creates a Payment record in Salesforce related to the Installment created at step 3.
    • Reduces the amount on the Installment with the amount of the Payment.
    • Updates the status of the Installment to Paid.

If the Payment was not completed the status of the Installment is updated to Failed. If you use a Source Package like NPSP, FinDock updates the data in this package.

* For certain payment methods like direct debit and acceptgiro, steps 5-9 are not always required since the payment will be handled by sending files to and receiving files from your bank. These files can be generated from the data created through the API with Payment Schedules.

Next steps

Migrate from API v1 to API v2

Get started with the Payment API

Create one-off and recurring payments through the API

Read the details in the API Reference