fastify-xplaid
transactions.refresh(accessToken)
Force-refresh transaction data for a Plaid Item.
transactions.refresh(accessToken)
Triggers Plaid to immediately pull fresh transaction data from the financial institution. Plaid will fire a TRANSACTIONS webhook when the refresh is complete. Does not return transaction data directly.
Signature
fastify.xplaid.transactions.refresh(
accessToken: string
): Promise<{ requestId: string }>
Params
| Name | Type | Required | Description |
|---|---|---|---|
accessToken | string | Yes | The Item's access token |
Returns
{ requestId: string } — confirmation only; data arrives via webhook.
Throws
Error: [xPlaid] accessToken is required and must be a non-empty string- Plaid API error with
.plaidErrorand.statusCode
Examples
User-initiated refresh
fastify.post("/accounts/refresh", async (request) => {
const item = await getPlaidItem(request.user.id);
await fastify.xplaid.transactions.refresh(item.accessToken);
return { message: "Refresh initiated. Transactions will update shortly." };
});
After re-authentication
fastify.post("/plaid/exchange-token", async (request) => {
const { accessToken } = await fastify.xplaid.link.exchangePublicToken(request.body.publicToken);
await db.plaidItem.update({ data: { accessToken } });
await fastify.xplaid.transactions.refresh(accessToken);
return { ok: true };
});
See also
- transactions.sync(accessToken, options?) — consume the refreshed data
AI Context
package: "@xenterprises/fastify-xplaid"
method: fastify.xplaid.transactions.refresh(accessToken)
use-when: Force-refresh transaction data for a Plaid Item — triggers a TRANSACTIONS/SYNC_UPDATES_AVAILABLE webhook when new data is ready
returns: { requestId }
