> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flinks.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate a PAD Link from a Contact

> Walk through the API flow to generate a Pre-Authorized Debit signing link from a contact ID.

<Warning>
  **Work in progress**

  This section is currently under active development as part of improvements planned for 2026. Content may change as we expand product capabilities.

  If you're interested in early access or want to learn more about what's coming, feel free to [reach out to the team](/guides/support/contact-flinks).
</Warning>

This guide walks through the complete flow to generate a PAD (Pre-Authorized Debit) signing link using the EFT API, starting from a contact ID. The PAD link is a URL you present to your end user so they can authorize the payment.

## Prerequisites

* A valid `x-client-id` API key
* A stored contact with at least one EFT bank account

## Overview

The flow requires four API calls in sequence:

```mermaid theme={null}
flowchart LR
    A[Get Contact] --> B[Create Transaction]
    B --> C[Get Schedule]
    C --> D[Get PAD]
```

| Step | Endpoint                             | Returns                            |
| ---- | ------------------------------------ | ---------------------------------- |
| 1    | `GET /api/v1/contacts/{contactId}`   | Contact details + bank account IDs |
| 2    | `POST /api/v1/transactions`          | Schedule with `id`                 |
| 3    | `GET /api/v1/schedules/{scheduleId}` | Schedule details with `padId`      |
| 4    | `GET /api/v1/pads/{padId}`           | PAD details with `padLink`         |

## Step 1: Get the Contact

Retrieve the contact to obtain their EFT bank account ID.

```bash theme={null}
curl 'https://payments.flinksapp.com/api/v1/contacts/{{contactId}}' \
  --header 'x-client-id: {{your-client-id}}'
```

From the response, note the `id` from the contact's EFT account — you'll use it as the `accountId` in the transaction request.

## Step 2: Create the Transaction

Create a DEBIT transaction using the contact's `contactId` and `accountId` from Step 1, and a `transactionCode` from the [transaction codes reference](/api/pay/endpoints/eft/transaction-codes).

```bash theme={null}
curl 'https://payments.flinksapp.com/api/v1/transactions' \
  --header 'Content-Type: application/json' \
  --header 'x-client-id: {{your-client-id}}' \
  --data '[{
    "transactionCode": 450,
    "amount": 250.00,
    "paymentDirection": "DEBIT",
    "currency": "CAD",
    "payor": {
      "accountInfo": {
        "accountId": "{{accountId}}"
      },
      "contactInfo": {
        "contactId": "{{contactId}}"
      }
    },
    "scheduleInfo": {
      "paymentFrequency": "Monthly",
      "startDate": "2026-05-01",
      "transactionsCount": 12
    }
  }]'
```

The response contains a `schedules` array. Note the `id` (schedule ID) from the first item.

<Note>
  The `padId` field in the create transaction response is `null` at this point. The PAD agreement is generated asynchronously — you need to poll the schedule to obtain it.
</Note>

## Step 3: Get the Schedule (poll for padId)

Retrieve the schedule to check if the PAD has been generated.

```bash theme={null}
curl 'https://payments.flinksapp.com/api/v1/schedules/{{scheduleId}}' \
  --header 'x-client-id: {{your-client-id}}'
```

Check the `padId` field in the response:

* If `padId` is **not null** — proceed to Step 4
* If `padId` is **null** — the PAD is still being generated; wait and retry

<Tip>
  We recommend polling every 2–3 seconds for up to 30 seconds. If `padId` is still null after that, contact Flinks support.
</Tip>

## Step 4: Get the PAD Link

Once you have the `padId`, retrieve the PAD agreement details including the signing link.

```bash theme={null}
curl 'https://payments.flinksapp.com/api/v1/pads/{{padId}}' \
  --header 'x-client-id: {{your-client-id}}'
```

The response includes a `padLink` field — this is the URL you present to your end user.

## Presenting the PAD to the End User

Redirect or display the `padLink` to your end user so they can review and sign the PAD agreement. Once signed, the payment schedule becomes active.

```javascript theme={null}
// Example: redirect user to the PAD signing page
window.location.href = padLink;
```

## Complete Example

```javascript theme={null}
const BASE_URL = 'https://payments.flinksapp.com/api/v1';
const headers = {
  'Content-Type': 'application/json',
  'x-client-id': 'your-client-id'
};

async function generatePadLink(contactId) {
  // Step 1: Get contact details
  const contact = await fetch(`${BASE_URL}/contacts/${contactId}`, { headers })
    .then(r => r.json());

  const accountId = contact.accounts.eftAccounts[0].id;

  // Step 2: Create transaction (450 = Misc. Payments — see transaction codes reference)
  const txResponse = await fetch(`${BASE_URL}/transactions`, {
    method: 'POST',
    headers,
    body: JSON.stringify([{
      transactionCode: 450,
      amount: 250.00,
      paymentDirection: 'DEBIT',
      currency: 'CAD',
      payor: {
        accountInfo: { accountId },
        contactInfo: { contactId }
      },
      scheduleInfo: {
        paymentFrequency: 'Monthly',
        startDate: '2026-05-01',
        transactionsCount: 12
      }
    }])
  }).then(r => r.json());

  const scheduleId = txResponse.schedules[0].id;

  // Step 3: Poll schedule for padId
  let padId = null;
  for (let i = 0; i < 10; i++) {
    const schedule = await fetch(`${BASE_URL}/schedules/${scheduleId}`, { headers })
      .then(r => r.json());

    if (schedule.padId) {
      padId = schedule.padId;
      break;
    }
    await new Promise(resolve => setTimeout(resolve, 3000));
  }

  if (!padId) throw new Error('PAD not generated within timeout');

  // Step 4: Get PAD link
  const pad = await fetch(`${BASE_URL}/pads/${padId}`, { headers })
    .then(r => r.json());

  return pad.padLink;
}
```

## API Reference

* [Get Contact](/api/pay/endpoints/eft/get-contact)
* [Transaction Codes](/api/pay/endpoints/eft/transaction-codes)
* [Create Transaction](/api/pay/endpoints/eft/create-transaction)
* [Get Schedule](/api/pay/endpoints/eft/get-schedule)
* [Get PAD Agreement](/api/pay/endpoints/eft/get-pad)
