@coinbase/cdp-sdk
Version:
SDK for interacting with the Coinbase Developer Platform Wallet API
30 lines (29 loc) • 1.72 kB
JavaScript
import { cdpApiClient } from "../../cdpApiClient.js";
/**
* Creates a merchant-initiated payment of funds from a CDP account owned by the merchant to a Coinbase user account or onchain address. Used for standalone refunds, goodwill disbursements, rebates, and other merchant-driven payouts that are not tied to a specific payment session.
This is an asynchronous operation. The disbursement is returned in `pending` status and transitions to `succeeded` (with associated `onchainTransactions`) or `failed` (with `error`).
* @summary Create a disbursement
*/
export const createDisbursement = (createDisbursementRequest, options) => {
return cdpApiClient({
url: `/v2/disbursements`,
method: "POST",
headers: { "Content-Type": "application/json" },
data: createDisbursementRequest,
}, options);
};
/**
* Returns a paginated list of disbursements created by the merchant. Each disbursement includes its source, target, status, amount, and timestamps. Only disbursements accessible by the current API key are returned.
* @summary List disbursements
*/
export const listDisbursements = (params, options) => {
return cdpApiClient({ url: `/v2/disbursements`, method: "GET", params }, options);
};
/**
* Retrieves a single disbursement by its ID, including source, target, status, amount, associated onchain transactions, error details (if failed), and timestamps. Only returns the disbursement if the API key has permission to access it.
* @summary Get a disbursement
*/
export const getDisbursement = (disbursementId, options) => {
return cdpApiClient({ url: `/v2/disbursements/${disbursementId}`, method: "GET" }, options);
};
//# sourceMappingURL=disbursements.js.map