Broadleaf Microservices
  • v1.0.0-latest-prod

Amazon Payment Services API Client

Client used for interacting with the amazon payment service related APIs.

getSignatureRequest

Creates a hashed signature based on the request params

Parameters

Parameter Type Required? Description

requestSignatureParams

Record<string, string | string[]>

The request params to create a hashed request signature

options

ClientOptions

The options to the HTTP call

Response

The signature string.

Example

import { AmazonPaymentServicesClient } from '@broadleaf/amazon-payment-services-api';
import type { ClientOptions } from '@broadleaf/commerce-core';

const options: ClientOptions = {
  applicationToken,
  baseHost,
  locale: currentLocale,
  preview,
};
const client = new AmazonPaymentServicesClient(options);
const signature = await client.getSignatureRequest(requestSignatureParams);

getSignatureResponse

Verifies a hashed signature based on the response params

Parameters

Parameter Type Required? Description

responseSignatureParams

Record<string, string | string[]>

The request params to create a hashed response signature.

options

ClientOptions

The options to the HTTP call

Response

Whether the signature was valid.

Example

import { AmazonPaymentServicesClient } from '@broadleaf/amazon-payment-services-api';
import type { ClientOptions } from '@broadleaf/commerce-core';

const options: ClientOptions = {
  applicationToken,
  baseHost,
  locale: currentLocale,
  preview,
};
const client = new AmazonPaymentServicesClient(options);
const isValid = await client.getSignatureResponse(responseSignatureParams);

getInstallments

Fetches the installments offered by Amazon Payment Services for the merchant account.

Parameters

Parameter Type Required? Description

installmentDetails

AmazonPaymentServicesInstallmentsRequest

The request param details to fetch installments

options

ClientOptions

The options to the HTTP call

Example

import { AmazonPaymentServicesClient } from '@broadleaf/amazon-payment-services-api';
import type { ClientOptions } from '@broadleaf/commerce-core';

const options: ClientOptions = {
  applicationToken,
  baseHost,
  locale: currentLocale,
  preview,
};
const client = new AmazonPaymentServicesClient(options);
const installments = await client.getInstallments(installmentDetails);