@coinbase/cdp-sdk
Version:
SDK for interacting with the Coinbase Developer Platform Wallet API
87 lines (78 loc) • 3.21 kB
JavaScript
import { cdpApiClient } from "../../cdpApiClient.js";
/**
* Create a new customer record. You can optionally request capabilities
and submit verification requirements in the same request.
This endpoint supports creating a customer with:
- Minimal data (customer type only)
- Capability requests
- KYC data submission
- Combined request for capability and required info for verification
* @summary Create a customer
*/
export const createCustomer = (createCustomerRequest, options) => {
return cdpApiClient({
url: `/v2/customers`,
method: "POST",
headers: { "Content-Type": "application/json" },
data: createCustomerRequest,
}, options);
};
/**
* List all customers. The API will return all customers that the API Key has
permissions to access. Results are not returned in any guaranteed order.
* @summary List customers
*/
export const listCustomers = (params, options) => {
return cdpApiClient({ url: `/v2/customers`, method: "GET", params }, options);
};
/**
* Preview the requirements a hypothetical customer of the given
`customerType` and jurisdiction would need to satisfy to enable the
requested `capabilities`, without creating a customer record.
Partner onboarding UIs can use this to render the collection flow
before any customer state exists.
Today this endpoint only previews the Terms of Service requirement:
the response's `RequirementsMap` will only ever contain a `tos` key.
Other requirement families (PII / CDD inputs) are not yet available
through this endpoint; use `POST /v2/customers` or
`PUT /v2/customers/{customerId}` to discover those via
`Customer.requirements`.
Only `customerType: individual` customers resident in or citizens
of the US are currently supported; every other combination returns
`400 invalid_request`.
* @summary Get customer requirements
*/
export const getCustomerRequirements = (params, options) => {
return cdpApiClient({ url: `/v2/customers/requirements`, method: "GET", params }, options);
};
/**
* Get a customer by their ID. Returns the full customer object.
* @summary Get a customer
*/
export const getCustomerById = (customerId, options) => {
return cdpApiClient({ url: `/v2/customers/${customerId}`, method: "GET" }, options);
};
/**
* Initiates deletion of the customer and all associated data. This operation
is idempotent — repeated calls for an already-deleted customer return 204.
A 404 is returned only when no customer with the given ID exists for the
caller's entity.
* @summary Delete a customer
*/
export const deleteCustomerById = (customerId, options) => {
return cdpApiClient({ url: `/v2/customers/${customerId}`, method: "DELETE" }, options);
};
/**
* Update customer information and/or request capability changes.
This endpoint supports partial updates. Provide only the fields you wish to change.
* @summary Update a customer
*/
export const updateCustomerById = (customerId, updateCustomerRequest, options) => {
return cdpApiClient({
url: `/v2/customers/${customerId}`,
method: "PUT",
headers: { "Content-Type": "application/json" },
data: updateCustomerRequest,
}, options);
};
//# sourceMappingURL=customers.js.map