Skip to content

Files

Latest commit

618e2d1 · Jun 4, 2025

History

History
305 lines (242 loc) · 25.1 KB

README.md

File metadata and controls

305 lines (242 loc) · 25.1 KB

Payouts

(payouts)

Overview

Available Operations

  • list - List payouts created.
  • create - Create a payout.
  • get - Get a payout.

list

Returns a list of payouts made.

Example Usage

import { Gr4vy } from "@gr4vy/sdk";

const gr4vy = new Gr4vy({
  merchantAccountId: "<id>",
  server: "sandbox",
  id: "example",
  bearerAuth: withToken({
    privateKey: fs.readFileSync("private_key.pem", "utf8"),
  }),
});

async function run() {
  const result = await gr4vy.payouts.list();

  for await (const page of result) {
    console.log(page);
  }
}

run();

Standalone function

The standalone function version of this method:

import { Gr4vyCore } from "@gr4vy/sdk/core.js";
import { withToken } from "@gr4vy/sdk/lib/auth.js";
import { payoutsList } from "@gr4vy/sdk/funcs/payoutsList.js";

// Use `Gr4vyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const gr4vy = new Gr4vyCore({
  merchantAccountId: "<id>",
  server: "sandbox",
  id: "example",
  bearerAuth: withToken({
    privateKey: fs.readFileSync("private_key.pem", "utf8"),
  }),
});

async function run() {
  const res = await payoutsList(gr4vy);
  if (res.ok) {
    const { value: result } = res;
    for await (const page of result) {
    console.log(page);
  }
  } else {
    console.log("payoutsList failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description Example
cursor string A pointer to the page of results to return. [object Object]
limit number The maximum number of items that are at returned. [object Object]
merchantAccountId string The ID of the merchant account to use for this request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.ListPayoutsResponse>

Errors

Error Type Status Code Content Type
errors.Error400 400 application/json
errors.Error401 401 application/json
errors.Error403 403 application/json
errors.Error404 404 application/json
errors.Error405 405 application/json
errors.Error409 409 application/json
errors.HTTPValidationError 422 application/json
errors.Error425 425 application/json
errors.Error429 429 application/json
errors.Error500 500 application/json
errors.Error502 502 application/json
errors.Error504 504 application/json
errors.SDKError 4XX, 5XX */*

create

Creates a new payout.

Example Usage

import { Gr4vy } from "@gr4vy/sdk";

const gr4vy = new Gr4vy({
  merchantAccountId: "<id>",
  server: "sandbox",
  id: "example",
  bearerAuth: withToken({
    privateKey: fs.readFileSync("private_key.pem", "utf8"),
  }),
});

async function run() {
  const result = await gr4vy.payouts.create({
    amount: 1299,
    currency: "EUR",
    paymentServiceId: "ed8bd87d-85ad-40cf-8e8f-007e21e55aad",
    paymentMethod: {
      id: "852b951c-d7ea-4c98-b09e-4a1c9e97c077",
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { Gr4vyCore } from "@gr4vy/sdk/core.js";
import { withToken } from "@gr4vy/sdk/lib/auth.js";
import { payoutsCreate } from "@gr4vy/sdk/funcs/payoutsCreate.js";

// Use `Gr4vyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const gr4vy = new Gr4vyCore({
  merchantAccountId: "<id>",
  server: "sandbox",
  id: "example",
  bearerAuth: withToken({
    privateKey: fs.readFileSync("private_key.pem", "utf8"),
  }),
});

async function run() {
  const res = await payoutsCreate(gr4vy, {
    amount: 1299,
    currency: "EUR",
    paymentServiceId: "ed8bd87d-85ad-40cf-8e8f-007e21e55aad",
    paymentMethod: {
      id: "852b951c-d7ea-4c98-b09e-4a1c9e97c077",
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("payoutsCreate failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
payoutCreate components.PayoutCreate ✔️ N/A
merchantAccountId string The ID of the merchant account to use for this request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<components.PayoutSummary>

Errors

Error Type Status Code Content Type
errors.Error400 400 application/json
errors.Error401 401 application/json
errors.Error403 403 application/json
errors.Error404 404 application/json
errors.Error405 405 application/json
errors.Error409 409 application/json
errors.HTTPValidationError 422 application/json
errors.Error425 425 application/json
errors.Error429 429 application/json
errors.Error500 500 application/json
errors.Error502 502 application/json
errors.Error504 504 application/json
errors.SDKError 4XX, 5XX */*

get

Retreives a payout.

Example Usage

import { Gr4vy } from "@gr4vy/sdk";

const gr4vy = new Gr4vy({
  merchantAccountId: "<id>",
  server: "sandbox",
  id: "example",
  bearerAuth: withToken({
    privateKey: fs.readFileSync("private_key.pem", "utf8"),
  }),
});

async function run() {
  const result = await gr4vy.payouts.get("4344fef2-bc2f-49a6-924f-343e62f67224");

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { Gr4vyCore } from "@gr4vy/sdk/core.js";
import { withToken } from "@gr4vy/sdk/lib/auth.js";
import { payoutsGet } from "@gr4vy/sdk/funcs/payoutsGet.js";

// Use `Gr4vyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const gr4vy = new Gr4vyCore({
  merchantAccountId: "<id>",
  server: "sandbox",
  id: "example",
  bearerAuth: withToken({
    privateKey: fs.readFileSync("private_key.pem", "utf8"),
  }),
});

async function run() {
  const res = await payoutsGet(gr4vy, "4344fef2-bc2f-49a6-924f-343e62f67224");
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("payoutsGet failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
payoutId string ✔️ N/A
merchantAccountId string The ID of the merchant account to use for this request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<components.PayoutSummary>

Errors

Error Type Status Code Content Type
errors.Error400 400 application/json
errors.Error401 401 application/json
errors.Error403 403 application/json
errors.Error404 404 application/json
errors.Error405 405 application/json
errors.Error409 409 application/json
errors.HTTPValidationError 422 application/json
errors.Error425 425 application/json
errors.Error429 429 application/json
errors.Error500 500 application/json
errors.Error502 502 application/json
errors.Error504 504 application/json
errors.SDKError 4XX, 5XX */*