Skip to content

Latest commit

 

History

History
577 lines (439 loc) · 34.8 KB

README.md

File metadata and controls

577 lines (439 loc) · 34.8 KB

ApplePay

(applePay)

Overview

Available Operations

Any domains that will be used to accept payments must first be verified with Apple.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/apple-pay.write scope.

Any domains that will be used to accept payments must first be verified with Apple.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/apple-pay.write scope.

Read our Apple Pay tutorial to learn more.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/apple-pay.read scope.

  • createSession - Create a session with Apple Pay to facilitate a payment.

Read our Apple Pay tutorial to learn more. A successful response from this endpoint should be passed through to Apple Pay unchanged.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/apple-pay.write scope.

  • linkToken - Connect an Apple Pay token to the specified account.

Read our Apple Pay tutorial to learn more. The token data is defined by Apple Pay and should be passed through from Apple Pay's response unmodified.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/cards.write scope.

registerMerchantDomains

Add domains to be registered with Apple Pay.

Any domains that will be used to accept payments must first be verified with Apple.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/apple-pay.write scope.

Example Usage

import { Moov } from "@moovio/sdk";

const moov = new Moov({
  security: {
    username: "",
    password: "",
  },
});

async function run() {
  const result = await moov.applePay.registerMerchantDomains({
    accountID: "c62b8770-bdbc-406f-8160-fddb553f5b33",
    registerApplePayMerchantDomains: {
      domains: [
        "checkout.classbooker.dev",
      ],
    },
  });

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { MoovCore } from "@moovio/sdk/core.js";
import { applePayRegisterMerchantDomains } from "@moovio/sdk/funcs/applePayRegisterMerchantDomains.js";

// Use `MoovCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const moov = new MoovCore({
  security: {
    username: "",
    password: "",
  },
});

async function run() {
  const res = await applePayRegisterMerchantDomains(moov, {
    accountID: "c62b8770-bdbc-406f-8160-fddb553f5b33",
    registerApplePayMerchantDomains: {
      domains: [
        "checkout.classbooker.dev",
      ],
    },
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

Parameter Type Required Description
request operations.RegisterApplePayMerchantDomainsRequest ✔️ The request object to use for the 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.RegisterApplePayMerchantDomainsResponse>

Errors

Error Type Status Code Content Type
errors.GenericError 400 application/json
errors.APIError 4XX, 5XX */*

updateMerchantDomains

Add or remove domains to be registered with Apple Pay.

Any domains that will be used to accept payments must first be verified with Apple.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/apple-pay.write scope.

Example Usage

import { Moov } from "@moovio/sdk";

const moov = new Moov({
  security: {
    username: "",
    password: "",
  },
});

async function run() {
  const result = await moov.applePay.updateMerchantDomains({
    accountID: "4dfea880-7ff8-42f8-bc8d-392cba179113",
    updateApplePayMerchantDomains: {
      addDomains: [
        "pay.classbooker.dev",
      ],
      removeDomains: [
        "checkout.classbooker.dev",
      ],
    },
  });

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { MoovCore } from "@moovio/sdk/core.js";
import { applePayUpdateMerchantDomains } from "@moovio/sdk/funcs/applePayUpdateMerchantDomains.js";

// Use `MoovCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const moov = new MoovCore({
  security: {
    username: "",
    password: "",
  },
});

async function run() {
  const res = await applePayUpdateMerchantDomains(moov, {
    accountID: "4dfea880-7ff8-42f8-bc8d-392cba179113",
    updateApplePayMerchantDomains: {
      addDomains: [
        "pay.classbooker.dev",
      ],
      removeDomains: [
        "checkout.classbooker.dev",
      ],
    },
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

Parameter Type Required Description
request operations.UpdateApplePayMerchantDomainsRequest ✔️ The request object to use for the 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.UpdateApplePayMerchantDomainsResponse>

Errors

Error Type Status Code Content Type
errors.GenericError 400 application/json
errors.APIError 4XX, 5XX */*

getMerchantDomains

Get domains registered with Apple Pay.

Read our Apple Pay tutorial to learn more.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/apple-pay.read scope.

Example Usage

import { Moov } from "@moovio/sdk";

const moov = new Moov({
  security: {
    username: "",
    password: "",
  },
});

async function run() {
  const result = await moov.applePay.getMerchantDomains({
    accountID: "5f873241-11ec-45e4-929d-00a704a9b582",
  });

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { MoovCore } from "@moovio/sdk/core.js";
import { applePayGetMerchantDomains } from "@moovio/sdk/funcs/applePayGetMerchantDomains.js";

// Use `MoovCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const moov = new MoovCore({
  security: {
    username: "",
    password: "",
  },
});

async function run() {
  const res = await applePayGetMerchantDomains(moov, {
    accountID: "5f873241-11ec-45e4-929d-00a704a9b582",
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

Parameter Type Required Description
request operations.GetApplePayMerchantDomainsRequest ✔️ The request object to use for the 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.GetApplePayMerchantDomainsResponse>

Errors

Error Type Status Code Content Type
errors.APIError 4XX, 5XX */*

createSession

Create a session with Apple Pay to facilitate a payment.

Read our Apple Pay tutorial to learn more. A successful response from this endpoint should be passed through to Apple Pay unchanged.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/apple-pay.write scope.

Example Usage

import { Moov } from "@moovio/sdk";

const moov = new Moov({
  security: {
    username: "",
    password: "",
  },
});

async function run() {
  const result = await moov.applePay.createSession({
    accountID: "7f4bef45-927c-48cf-9312-d337467ac9fb",
    createApplePaySession: {
      domain: "checkout.classbooker.dev",
      displayName: "Kaylee40",
    },
  });

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { MoovCore } from "@moovio/sdk/core.js";
import { applePayCreateSession } from "@moovio/sdk/funcs/applePayCreateSession.js";

// Use `MoovCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const moov = new MoovCore({
  security: {
    username: "",
    password: "",
  },
});

async function run() {
  const res = await applePayCreateSession(moov, {
    accountID: "7f4bef45-927c-48cf-9312-d337467ac9fb",
    createApplePaySession: {
      domain: "checkout.classbooker.dev",
      displayName: "Kaylee40",
    },
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

Parameter Type Required Description
request operations.CreateApplePaySessionRequest ✔️ The request object to use for the 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.CreateApplePaySessionResponse>

Errors

Error Type Status Code Content Type
errors.GenericError 400, 409, 422 application/json
errors.APIError 4XX, 5XX */*

linkToken

Connect an Apple Pay token to the specified account.

Read our Apple Pay tutorial to learn more. The token data is defined by Apple Pay and should be passed through from Apple Pay's response unmodified.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/cards.write scope.

Example Usage

import { Moov } from "@moovio/sdk";

const moov = new Moov({
  security: {
    username: "",
    password: "",
  },
});

async function run() {
  const result = await moov.applePay.linkToken({
    accountID: "3f415d64-c57f-409e-80d0-cb8bd8246ace",
    linkApplePay: {
      token: {
        paymentData: {
          version: "EC_v1",
          data: "3+f4oOTwPa6f1UZ6tG...CE=",
          signature: "MIAGCSqGSIb3DQ.AAAA==",
          header: {
            ephemeralPublicKey: "MFkwEK...Md==",
            publicKeyHash: "l0CnXdMv...D1I=",
            transactionId: "32b...4f3",
          },
        },
        paymentMethod: {
          displayName: "Visa 1234",
          network: "Visa",
          type: "debit",
        },
        transactionIdentifier: "32b...4f3",
      },
      billingContact: {
        addressLines: [
          "123 Sesame Street",
        ],
        locality: "Phoenix",
        postalCode: "30345",
        administrativeArea: "AZ",
        countryCode: "US",
      },
    },
  });

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { MoovCore } from "@moovio/sdk/core.js";
import { applePayLinkToken } from "@moovio/sdk/funcs/applePayLinkToken.js";

// Use `MoovCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const moov = new MoovCore({
  security: {
    username: "",
    password: "",
  },
});

async function run() {
  const res = await applePayLinkToken(moov, {
    accountID: "3f415d64-c57f-409e-80d0-cb8bd8246ace",
    linkApplePay: {
      token: {
        paymentData: {
          version: "EC_v1",
          data: "3+f4oOTwPa6f1UZ6tG...CE=",
          signature: "MIAGCSqGSIb3DQ.AAAA==",
          header: {
            ephemeralPublicKey: "MFkwEK...Md==",
            publicKeyHash: "l0CnXdMv...D1I=",
            transactionId: "32b...4f3",
          },
        },
        paymentMethod: {
          displayName: "Visa 1234",
          network: "Visa",
          type: "debit",
        },
        transactionIdentifier: "32b...4f3",
      },
      billingContact: {
        addressLines: [
          "123 Sesame Street",
        ],
        locality: "Phoenix",
        postalCode: "30345",
        administrativeArea: "AZ",
        countryCode: "US",
      },
    },
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

Parameter Type Required Description
request operations.LinkApplePayTokenRequest ✔️ The request object to use for the 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.LinkApplePayTokenResponse>

Errors

Error Type Status Code Content Type
errors.GenericError 400, 409 application/json
errors.LinkApplePayError 422 application/json
errors.APIError 4XX, 5XX */*