function payment.dd.agreement.list

Fetch a list of direct debit agreements.

Arguments:

argrequired?syntaxinfo
payeeIDYposintcustID of payee/supplier account which takes payments from the payer
payerIDYposintcustID of payer/customer account which makes payments to the payee
agreementIDNlist:posintoptional filter; will limit results to only contain these DD agreements
agreementID.minNposintoptional filter; limits results to only include agreements with an agreementID greater or equal to this value
billing_companyIDNposintoptional filter; limits results to only include agreements with this billing company
is_payee_defaultNbooleanoptional filter; limits results to only include agreements that are established via the payee's preferred DD processing provider
providerIDNposintoptional filter; limits results to agreements that are established via this particular DD processing provider
sortNset:agreementID,is_payee_defaultspecify the sort order for the returned results
statusNset:active,cancelledoptional filter; limits results to only include agreements with the specified status
provider_refNstringoptional filter; limits results to only include agreements with this provider reference string
bank_accnumNposintoptional filter; limits results to only include agreements linked to this bank account number
bank_sortcodeNposintoptional filter; limits results to only include agreements linked to this bank sort code
optfieldsNset:paytotalsselects additional fields to be returned
startfromNunsintoptional filter; skip this many records in the return data

Example 1

List DD agreements for custID 50000

Perl example request:

POST https://live.apicontrol.co.uk/1/json
{
  'payerID' => 50000,
  'payeeID' => 13810,
  'billing_companyID' => 2
}

Perl example response:

{
          'success' => 1,
          'error' => '',
          'errornum' => '',
          'errordiags' => '',
          'results' => {
                         'totmatches' => '1',
                         'data' => [
                                     {
                                       'bank_sortcode' => '010203',
                                       'provider_ref' => 'SKYCOM50000',
                                       'status' => 'active',
                                       'is_payee_default' => 1,
                                       'date_cancelled' => '0000-00-00',
                                       'date_created' => '2008-02-16',
                                       'agreementID' => '228',
                                       'date_lastused' => '2013-05-01',
                                       'providerID' => '1',
                                       'payerID' => '50000',
                                       'payeeID' => '13810',
                                       'bank_accnum' => '12345678',
                                       'billing_companyID' => '2'
                                     }
                                   ]
                       }
}

Example 2

List DD agreements for custID 50000, but also request the paytotals data

Perl example request:

POST https://live.apicontrol.co.uk/1/json
{
  'optfields' => 'paytotals',
  'payerID' => 50000,
  'payeeID' => 13810,
  'billing_companyID' => 2
}

In the response you can see that 74 payments totalling £153.08 have been successfully taken via this direct debit and that the last successful payment was taken on 15 April 2013, and that 1 payment of £1.20 was submitted on 1 May 2013 but was declined by the bank.

Perl example response:

{
          'success' => 1,
          'error' => '',
          'errornum' => '',
          'errordiags' => '',
          'results' => {
                         'totmatches' => '1',
                         'data' => [
                                     {
                                       'bank_sortcode' => '010203',
                                       'paytotals' => {
                                                        'paid' => {
                                                                    'tot_amount' => '153.08',
                                                                    'newest_date' => '2013-04-15',
                                                                    'num_entries' => '74'
                                                                  },
                                                        'declined' => {
                                                                        'tot_amount' => '1.20',
                                                                        'newest_date' => '2013-05-01',
                                                                        'num_entries' => '1'
                                                                      }
                                                      },
                                       'provider_ref' => 'SKYCOM50000',
                                       'status' => 'active',
                                       'is_payee_default' => 1,
                                       'date_cancelled' => '0000-00-00',
                                       'date_created' => '2008-02-16',
                                       'agreementID' => '228',
                                       'date_lastused' => '2013-05-01',
                                       'providerID' => '1',
                                       'payerID' => '50000',
                                       'payeeID' => '13810',
                                       'bank_accnum' => '12345678',
                                       'billing_companyID' => '2'
                                     }
                                   ]
                       }
}