Import GoCardless Data with Merchant Groups
This guide explains how to migrate existing GoCardless direct debit mandates to Unaric Payments without disrupting authorisations. The process consist of exporting mandate data from GoCardless, importing and linking it to Salesforce objects, and providing the final data to Unaric Payments for activation.
Overview
Data can be transferred from Direct Debit processor to Direct Debit processor by a Deed of Transfer. That process will move the existing mandates from the old processor to the new one.
This is achieved by the transfer of a file of data that is exported from one system and then imported to the new one. GoCardless will manage this process for you.
If you are an existing GoCardless customer you will not need to go through the Deed of Transfer process.
In order for your existing GoCardless mandates to be made usable by Unaric Payments they have to be imported into the Salesforce org that is being used for payment processing.
The object inside of Salesforce that contains mandate information is called Authorisation. By default the Authorisation object is not linked to anything else inside the Salesforce org but most implementations will have had customisation applied that will create these links. Creating these links when data is imported is where the complexity lies.
How it works
The Unaric Payments Authorisation object contains two fields that, when repeat payment requests are received, validate the submission before processing it. These fields are Unaric Payments Repeat Token and Payment Service Provider Repeat Token.
- Unaric Payments Repeat Token is a unique reference generated by Unaric Payments for every authorisation that is processed.
- Payment Service Provider Repeat Token is GoCardless's internal reference value for mandates. It is provided by GoCardless.
Workflow
The basic process is:
Export the mandate data from GoCardless.
Import data into the Unaric Payments Authorisation object in Salesforce
Resolve the links to other Salesforce objects from Authorisation.
Export the Authorisation object data ready for import into the Unaric Payments database.
Import the data into the Unaric Payments database (done by Unaric Payments support). Once data has been imported to Salesforce, the Unaric Payments Salesforce package can then take control of the creation of payment requests.
If you are making use of the GoCardless subscription processing, you will have to liaise with GoCardless to ensure these are switched off before giving Unaric Payments control to take payments. Otherwise, you might end up being double charged.
The target Salesforce object
The following table gives a list of Unaric Payments Authorisation object's relevant fields and describes where the data comes from to populate each one.
Field Label | API Name | Data source |
|---|---|---|
Unaric Payments Repeat Token | asp04__Asperato_Repeat_Token__c | Generated (see comment below) |
Billing Address City | asp04__Billing_Address_City__c | GoCardless customer record (city) |
Billing Address Country | asp04__Billing_Address_Country__c | GoCardless customer record (country_code) |
Billing Address PostalCode | asp04__Billing_Address_PostalCode__c | GoCardless customer record (postal_code) |
Billing Address State | asp04__Billing_Address_State__c | Leave blank (equates to the County but GoCardless don’t seem to store this) |
Billing Address Street | asp04__Billing_Address_Street__c | GoCardless customer record (address_line1 and address_line2) |
Company Name | asp04__Company_Name__c | GoCardless customer record (company_name) |
CPA Granted | asp04__CPA_Granted__c | Hard code to ‘true’ |
Currency | CurrencyISOCode | (See comment below) |
Customer ID | asp04__Customer_ID__c | Derived from the Unaric Payments settings (see comment below) |
asp04__Email__c | GoCardless customer record (email) | |
First Name | asp04__First_Name__c | GoCardless customer record (given_name) |
Last Name | asp04__Last_Name__c | GoCardless customer record (family_name) |
Merchant Group | asp04__Merchant_Group_Picklist__c | Name of the Merchant Group that the record is related to (see comment below) |
Mandate Reference | asp04__Mandate_Reference__c | GoCardless mandate record (reference) |
Payment Route Options | asp04__Payment_Route_Options__c | Hard code to ‘Direct Debit’ |
Payment Route Selected | asp04__Payment_Route_Selected__c | Hard code to ‘Direct Debit’ |
Payment Service Provider Repeat Token | asp04__PSP_Repeat_Token__c | GoCardless mandate record (id) [The tokens usually begins with ‘MD’ unless you are importing very old GoCardless data] |
Status | asp04__Status__c | Hard code to ‘In force’ |
Unaric Payments Repeat Token
When Unaric Payments generates these, use this format: cccc-Annnnnnnnnn.
- cccc is the customer ID
- A is a fixed constant
- nnnnnnnnnn is a number giving uniqueness
When generating these references you should use the form: cccc-Aconvnnnnnnn.
- cccc is the customer ID
- Aconv is a fixed constant
- nnnnnnn is a value giving uniqueness (it doesn’t have to be numeric but should not contain spaces)
It is important that these references are unique so if a series of data imports are created you should ensure the number sequences don’t overlap, even across different merchant groups.
Customer ID
The Customer ID is a value that links the Authorisation to a particular Unaric Payments customer configuration. This value can be obtained from the Customer ID in the custom setting object called Unaric Payments settings and is also displayed on the Unaric Payments Setup tab in the Unaric Payments app.
The field has a formula default value that should resolve the content automatically, but it would be good policy to set the content explicitly in case the data load process ignores the formula.
Please contact Unaric Payments if you need assistance identifying your customer ID.
Merchant Group
The Merchant Group field dictates which of the set of payment service provider connections the Authorisation is related to. When an Authorisation or a Payment is created as part of a normal business flow the value to be used would be resolved by logic in that flow, but for this load process it will need to be set explicitly.
The value used in this field needs to exactly match the name(s) used on the Unaric Payments Setup tab. If the text is different then the data loaded will not work as expected.
Contact Unaric Payments support if you need assistance identifying your Merchant Group names.
Currency
If the target org has multi-currency enabled make sure that you set the currency code correctly on the Authorisation record because that will then be reflected into the payments that will be subsequently generated using the mandate information.
Setup
- Export the mandate data from GoCardless
‘Out of the tin’ GoCardless don’t provide a single report that will give the data needed for the conversion. However you can engage with GoCardless support and they should be able to provide you with a single CSV file with the required data.
To get the data you need you can grab the Customer data by using the Export button on the Customer screen inside the GoCardless desktop. You can then get the Mandate data by using the Events screen. Change the selection such that ‘All resources’ reads ‘Mandates’, ‘All actions’ reads ‘Active’ and ‘Any time’ is left as it is. (This will also give cancelled mandates but you can filter these out by sorting the column named ‘mandate.status’ and removing the lines that are cancelled). You can then export this data to CSV. You will have to merge these two CSV files based on customer ID to get all the data you need.
If you are loading data from different GoCardless accounts into different merchant groups then you will need to repeat this process for each account.
- Import data into the Salesforce Authorisation object
We recommend using the Salesforce Data Loader program to insert data into the Authorisation object from a CSV file that you create from the GoCardless data.
- Resolve the links to other objects from Authorisation
This is probably the most difficult step and the one that this document can’t give real guidance about other than by example.
For example, if the Authorisation object has been linked to Account then the process will be to add Account IDs to the custom field(s) on the Authorisation object. The issue will be identifying that relationship. The match could be done by email address, i.e. the email address stored on the Authorisation record matching with an email address on the Account records. It could also be done by matching on some sort of custom data if that is available inside of GoCardless (you might want to consider this when exporting data).
Data Loader can also be used in this process to build up a suitable set of data that can then update the Authorisation rows in bulk.
- Export the data to Unaric Payments
Once you have created all the Authorisation rows and ensured that the Unaric Payments Repeat Token and Payment Service Provider Repeat Token fields contain data, create a CSV file using Data Loader containing these two fields, the Merchant Group, and the Salesforce record ID. Once exported, send this file to Unaric Payments support so they can import it to the database.
To reiterate, the data required by Unaric Payments is:
Field label | API Name |
|---|---|
Salesforce ID | ID |
Unaric Payments Repeat Token | asp04__Asperato_Repeat_Token__c |
Payment Service Provider Repeat Token | asp04__PSP_Repeat_Token__c |
Merchant Group | asp04__Merchant_Group__c |