Skip to content

Exchange Token

Request URL

POST /public/customer/plaid/exchange-public-token

Description

This endpoint will allow the customer session corresponding to the provided 'x-connectfi-jwtoken' header to exchange a Plaid public token (received via Plaid Link) for a Plaid access token. This action can also be facilitated through the payment page HTML that is provided when the customer payment link email is sent or, depending on client configurations, the payment link webhook.

Schema

Property table for public/customer/plaid/exchange-public-token

Property Description Required Schema
public_token public_token Yes {
  "type": "string"
}

Request Body

{
  "public_token": "public-sandbox-443c68a5-2ef4-4cb7-8fd5-1c5747e8ff51"
}

Snippet Examples

javascript

const axios = require('axios');
const data = {
  "public_token": "public-sandbox-443c68a5-2ef4-4cb7-8fd5-1c5747e8ff51"
};
const config = {
  method: 'POST',
  url: '${CONNECTFI_BASE_URL}/public/customer/plaid/exchange-public-token',
  headers: {
    'Content-Type': "application/json",
    'x-connectfi-jwtoken': "A long random string token received from /public/customer/payment/link request"
  },
  data
};

let result;
try {
  result = await axios.request(config);
  if (result.status === 200) {
    console.log(JSON.stringify(result.data));
  }
} catch (err) {
  console.log({
    errCode: err.code,
    responseStatus: err.response && err.response.status,
    data: err.response && JSON.stringify(err.response.data)
  });
}

cURL

curl --location "CONNECTFI_BASE_URL/public/customer/plaid/exchange-public-token" --data "{  \"public_token\":\"public-sandbox-443c68a5-2ef4-4cb7-8fd5-1c5747e8ff51\"}" --header "Content-Type: application/json" --header "x-connectfi-jwtoken: A long random string token received from /public/customer/payment/link request" 

Successful Response Examples

200 SUCCESSFUL RESPONSE

HEADERS

Header Value
Content-Type application/json
x-connectfi-jwtoken A long random string token received from /public/customer/payment/link request

REQUEST BODY

{
  "public_token": "public-sandbox-443c68a5-2ef4-4cb7-8fd5-1c5747e8ff51"
}

RESPONSE BODY

{
    "code": "0",
    "data": {
        "result": true
    },
    "requestId": "b40fa46050c811efb9c8eca582d34911"
}