- create - Create account updater job
Schedule one or more stored cards for an account update.
import { Gr4vy, withToken } from "@gr4vy/sdk";
import fs from "fs";
const gr4vy = new Gr4vy({
id: "example",
server: "sandbox",
merchantAccountId: "default",
bearerAuth: withToken({
privateKey: fs.readFileSync("private_key.pem", "utf8"),
}),
});
async function run() {
const result = await gr4vy.accountUpdater.jobs.create({
paymentMethodIds: [
"ef9496d8-53a5-4aad-8ca2-00eb68334389",
"f29e886e-93cc-4714-b4a3-12b7a718e595",
],
});
console.log(result);
}
run();The standalone function version of this method:
import { Gr4vyCore } from "@gr4vy/sdk/core.js";
import { accountUpdaterJobsCreate } from "@gr4vy/sdk/funcs/accountUpdaterJobsCreate.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>",
bearerAuth: process.env["GR4VY_BEARER_AUTH"] ?? "",
});
async function run() {
const res = await accountUpdaterJobsCreate(gr4vy, {
paymentMethodIds: [
"ef9496d8-53a5-4aad-8ca2-00eb68334389",
"f29e886e-93cc-4714-b4a3-12b7a718e595",
],
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("accountUpdaterJobsCreate failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
accountUpdaterJobCreate |
components.AccountUpdaterJobCreate | ✔️ | 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. |
Promise<components.AccountUpdaterJob>
| 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 | */* |