npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@sourceallies/payment-gateway

v0.10.5

Published

Javascript helper package for Source Allies Payment Gateway

Downloads

35

Readme

@sourceallies/payment-gateway

Introduction

npm version

NPM package used to interface your website with Source Allies Payment Gateway. The developer documentation for this package can be found here. A tutorial of how to integrate Payment Gateway with your website can be found here.

Enums

Enumeration: Environment

Index

Enumeration members

Enumeration members

DEV

DEV: = "DEV"


LOCAL

LOCAL: = "LOCAL"


PROD

PROD: = "PROD"


QUAL

QUAL: = "QUAL"

Documentation - v0.10.5

Index

Enumerations

Interfaces

Type aliases

Variables

Functions

Type aliases

AccountType

Ƭ AccountType: "checking" | "savings" | "businessChecking"

Variables

NUMBERS_REGEX

Const NUMBERS_REGEX: RegExp = /^[0-9]+$/

Functions

buildApplePayRequestData

buildApplePayRequestData(__namedParameters: { amount: string ; billTo: undefined | BillTo ; customer: undefined | Customer ; gatewayData: GatewayData ; lineItems: undefined | LineItemSingle[] | LineItemsRecurring[] ; order: Order ; paymentData: undefined | null | ApplePayPayment ; paymentSchedule: undefined | PaymentSchedule ; phoneNumber: undefined | string ; preferredName: undefined | string ; surcharge: undefined | ExtendedAmountType }): TransactionData | SubscriptionData | null

Creates the TransactionData SubscriptionData object with the correct fields. paymentData is derived from the argument of the function you define for Apple Pay's applePaySession.onpaymentauthorized function. Apple Pay will pass in an event to the function you defined. This event will have a property called payment. event.payment is what needs to be passed as the paymentData argument of this function.

If you do not specify the billTo parameter, the following fields are required for paymentData (Apple Pay may not set these values in event.payment):

  • paymentData.billingContact
  • paymentData.billingContact.givenName
  • paymentData.billingContact.familyName Leaving these fields out may cause unexpected behavior. See Apple Pay Web Reference for more details.

If the lineItems parameter is not passed in, the following one will be added as a line item:

listItems = [
    {
        itemId: 'invoice',
        name: 'Invoice Payment',
        unitPrice: parseFloat(requestData.amount),
        quantity: 1
    }
];

This requires amount to be able to be parsed to a float. If it is not, null is returned.

Return Value

The return value is then used in processTransaction or processSubscription.

Parameters:

Name | Type | ------ | ------ | __namedParameters | { amount: string ; billTo: undefined | BillTo ; customer: undefined | Customer ; gatewayData: GatewayData ; lineItems: undefined | LineItemSingle[] | LineItemsRecurring[] ; order: Order ; paymentData: undefined | null | ApplePayPayment ; paymentSchedule: undefined | PaymentSchedule ; phoneNumber: undefined | string ; preferredName: undefined | string ; surcharge: undefined | ExtendedAmountType } |

Returns: TransactionData | SubscriptionData | null

The transaction data, subscription data, or null


buildApplePayTransactionRequestData

buildApplePayTransactionRequestData(paymentData: ApplePayPayment | null | undefined, gatewayData: GatewayData, amount: string, order: Order, customer?: Customer, lineItems?: LineItemSingle[], billTo?: BillTo): TransactionData | null

deprecated please use processApplePayRequest

Creates the TransactionData object with the correct fields. paymentData is derived from the argument of the function you define for Apple Pay's applePaySession.onpaymentauthorized function. Apple Pay will pass in an event to the function you defined. This event will have a property called payment. event.payment is what needs to be passed as the paymentData argument of this function.

If you do not specify the billTo parameter, the following fields are required for paymentData (Apple Pay may not set these values in event.payment):

  • paymentData.billingContact
  • paymentData.billingContact.givenName
  • paymentData.billingContact.familyName Leaving these fields out may cause unexpected behavior. See Apple Pay Web Reference for more details.

If the lineItems parameter is not passed in, the following one will be added as a line item:

listItems = [
    {
        itemId: 'invoice',
        name: 'Invoice Payment',
        unitPrice: parseFloat(requestData.amount),
        quantity: 1
    }
];

This requires amount to be able to be parsed to a float. If it is not, null is returned.

Return Value

The return value is then used in processTransaction.

Parameters:

Name | Type | Description | ------ | ------ | ------ | paymentData | ApplePayPayment | null | undefined | The argument passed into Apple's applePaySession.onpaymentauthorized function. | gatewayData | GatewayData | Your Payment Gateway partner information. | amount | string | The monetary value of the transaction being processed. This must be in the form of a number. | order | Order | An object containing the order description and invoice number. | customer? | Customer | An object containing customer email. | lineItems? | LineItemSingle[] | Line items you want included in the transaction. | billTo? | BillTo | Bill to information for the paying user. This parameter is optional. If it is not specified, the bill to information will be built from paymentData. |

Returns: TransactionData | null

 Transaction data ready to be called with `processTransaction` if paymentData is not null,
 or returns null if amount is not a number or paymentData is null.

buildApplePayValidationRequestData

buildApplePayValidationRequestData(event: ApplePayValidateMerchantEvent | null | undefined, gatewayData: GatewayData, clientCanonicalName: string, context: string): ValidationData | null

Builds the ValidationData object. This function should be called in the applepaysession.onvalidatemerchant function you define. The argument passed in to applepaysession.onvalidatemerchant should be passed in as the event parameter.

Example Usage

applepaysession.onvalidatemerchant = (event) => {
    const validationData = paymentGateway.buildApplePayValidationRequestData(
        event,
        gatewayData,
        clientCanonicalName,
        context
    );
    paymentGateway.validateApplePayRequest(callback, validationData, environment);
}

Return Value

The return value is then used in validateApplePayRequest.

Parameters:

Name | Type | Description | ------ | ------ | ------ | event | ApplePayValidateMerchantEvent | null | undefined | The event paramenter passed in to the applepaysession.onvalidatemerchant callback. | gatewayData | GatewayData | Your Payment Gateway partner information. | clientCanonicalName | string | The client canonical name you use for Apple Pay. | context | string | The hostname of your website. |

Returns: ValidationData | null

 If event is null or missing property validationURL, null is returned.

buildGooglePayRequestData

buildGooglePayRequestData(__namedParameters: { amount: string ; billTo: undefined | BillTo ; customer: undefined | Customer ; gatewayData: GatewayData ; lineItems: undefined | LineItemSingle[] | LineItemsRecurring[] ; order: Order ; paymentData: undefined | null | PaymentData ; paymentSchedule: undefined | PaymentSchedule ; phoneNumber: undefined | string ; preferredName: undefined | string ; shipTo: undefined | ShipTo ; surcharge: undefined | ExtendedAmountType }): TransactionData | SubscriptionData | null

Creates the TransactionData SubscriptionData object with the correct fields. paymentData is generated from Google's paymentsClient.loadPaymentData().

If you do not specify the billTo parameter, the following properties are required for paymentData (Google Pay may not set these properties):

  • paymentData.paymentMethodData.info
  • paymentData.paymentMethodData.info.billingAddress
  • paymentData.paymentMethodData.info.billingAddress.name Leaving these fields out may cause unexpected behavior. Make sure billingAddressRequired is set to true in your card parameters if you are not passing in the billTo parameter. See Google Pay Web Reference for more details.

If the lineItems parameter is not passed in, the following one will be added as a line item:

lineItems = [
    {
        itemId: 'invoice',
        name: 'Invoice Payment',
        unitPrice: parseFloat(requestData.amount),
        quantity: 1
    }
];

This requires amount to be able to be parsed to a float. If it is not, null is returned.

Return Value

The return value is then used in processTransaction or processSubscription.

Parameters:

Name | Type | ------ | ------ | __namedParameters | { amount: string ; billTo: undefined | BillTo ; customer: undefined | Customer ; gatewayData: GatewayData ; lineItems: undefined | LineItemSingle[] | LineItemsRecurring[] ; order: Order ; paymentData: undefined | null | PaymentData ; paymentSchedule: undefined | PaymentSchedule ; phoneNumber: undefined | string ; preferredName: undefined | string ; shipTo: undefined | ShipTo ; surcharge: undefined | ExtendedAmountType } |

Returns: TransactionData | SubscriptionData | null

The transaction data, subscription data, or null


buildGooglePayTransactionRequestData

buildGooglePayTransactionRequestData(paymentData: PaymentData | null | undefined, gatewayData: GatewayData, amount: string, order: Order, customer?: Customer, lineItems?: LineItemSingle[], billTo?: BillTo, shipTo?: ShipTo, phoneNumber?: undefined | string): TransactionData | null

deprecated

Please use buildGooglePayRequestData

Creates the TransactionData object with the correct fields. paymentData is generated from Google's paymentsClient.loadPaymentData().

If you do not specify the billTo parameter, the following properties are required for paymentData (Google Pay may not set these properties):

  • paymentData.paymentMethodData.info
  • paymentData.paymentMethodData.info.billingAddress
  • paymentData.paymentMethodData.info.billingAddress.name Leaving these fields out may cause unexpected behavior. Make sure billingAddressRequired is set to true in your card parameters if you are not passing in the billTo parameter. See Google Pay Web Reference for more details.

If the lineItems parameter is not passed in, the following one will be added as a line item:

lineItems = [
    {
        itemId: 'invoice',
        name: 'Invoice Payment',
        unitPrice: parseFloat(requestData.amount),
        quantity: 1
    }
];

This requires amount to be able to be parsed to a float. If it is not, null is returned.

Return Value

The return value is then used in processTransaction or processSubscription.

Parameters:

Name | Type | Description | ------ | ------ | ------ | paymentData | PaymentData | null | undefined | The object returned from Google's paymentsClient.loadPaymentData(). | gatewayData | GatewayData | Your Payment Gateway partner information. | amount | string | The monetary value of the transaction being processed. This must be in the form of a number. | order | Order | An object containing the order description and invoice number. | customer? | Customer | An object containing customer email. | lineItems? | LineItemSingle[] | Line items you want included in the transaction. This parameter is optional. If it is not specified, the default lineItems will be used. | billTo? | BillTo | Bill to information for the paying user. This parameter is optional. If it is not specified, the bill to information will be built from paymentData. | shipTo? | ShipTo | Ship to information for the paying user. This parameter is optional. | phoneNumber? | undefined | string | Phone number provided by user on the form. This Parameter is optional. |

Returns: TransactionData | null

 Transaction data ready to be called with `processTransaction` if paymentData is not null,
 or returns null if amount is not a number or paymentData is null.

buildRequestData

buildRequestData(requestDataParams: RequestDataParams): RequestData | null

Builds the RequestData object to be used in buildTransactionRequestData or buildSubscriptionRequestData. The only fields required for parament billTo are firstName and lastName. The paremeter customer is not required but must have a value passed in (i.e. null if you do not want to use it). The parameter order is only needed for a recurring transaction. Although these are optional, we highly recommend including all of them in all payments. *NOTE: If you are using this in a TypeScript node project, all the paremeters will be required except for the optional ones in the parameter billTo.

Return Value

The return value is then used in buildTransactionRequestData or buildSubscriptionRequestData

Parameters:

Name | Type | Description | ------ | ------ | ------ | requestDataParams | RequestDataParams | An object containing the data from the form that has yet to be structured into a proper RequestData type. |

Returns: RequestData | null

 If response is null or it does not contain opaqueData, null is
 returned.

buildSubscriptionRequestData

buildSubscriptionRequestData(requestData: RequestData | null, gatewayData: GatewayData, paymentSchedule: PaymentSchedule, lineItems?: LineItemsRecurring[]): SubscriptionData | null

Creates the SubscriptionData object containing the correct fields. requestData can be generated by calling buildRequestData.

If the lineItems` parameter is not passed in, the following one will be added as a line item:

listItems = [
    {
        itemCode: 'invoice',
        name: 'Invoice Payment',
        amount: parseFloat(requestData.amount),
        description: 'invoice payment'
    }
];

This requires requestData.amount to be able to be parsed to a float. If it is not, null is returned.

Return Value

The return value is then used in processSubscription.

Parameters:

Name | Type | Description | ------ | ------ | ------ | requestData | RequestData | null | The data needed to make the request. | gatewayData | GatewayData | Your Payment Gateway partner information. | paymentSchedule | PaymentSchedule | The schedule of the recurring payment. | lineItems? | LineItemsRecurring[] | Line items you want included in the subscription. |

Returns: SubscriptionData | null

 If requestData is null, null is returned.

buildTransactionRequestData

buildTransactionRequestData(requestData: RequestData | null, gatewayData: GatewayData, lineItems?: LineItemSingle[]): TransactionData | null

Creates the TransactionData object containing the correct fields. requestData can be generated by calling buildRequestData. If the lineItems parameter is not passed in, the following one will be added as a line item:

lineItems = [
    {
        itemId: 'invoice',
        name: 'Invoice Payment',
        unitPrice: parseFloat(requestData.amount),
        quantity: 1
    }
];

Return Value

The returned value is then used in processTransaction.

Parameters:

Name | Type | Description | ------ | ------ | ------ | requestData | RequestData | null | The data needed to make the request. | gatewayData | GatewayData | Your Payment Gateway partner information. | lineItems? | LineItemSingle[] | Line items you want included in the transaction. |

Returns: TransactionData | null

 If requestData is null, null is returned.

encryptPaymentData

encryptPaymentData(response: any | void, authorizeNetApiKey: string, paymentData: CardData | BankData): SecureData | null

Creates the correct payment object to be used in the call to AcceptJS to encrypt the payment data. The paremeter response is the response body of getMerchantDetails.

Parameters:

Name | Type | Description | ------ | ------ | ------ | response | any | void | The response body as a JavaScript object from HTTP request in getMerchantDetails. | authorizeNetApiKey | string | Your Authorize.NET API key. | paymentData | CardData | BankData | The card or bank payment data that will be used for the request. |

Returns: SecureData | null

 If response is void or does not have publicClientKey, null is
 returned.

getMerchantDetails

ConstgetMerchantDetails(callbackFunction: (xmlHttpRequest: XMLHttpRequest) => void, gatewayData: GatewayData, env: Environment): void

Makes an HTTP request to get the merchant details from Payment Gateway. When the response is received, callbackFunction is called with the XMLHttpRequest object as the parameter. The body of the HTTP request can then be parsed to JSON and used in encryptPaymentData.

Parameters:

Name | Type | Description | ------ | ------ | ------ | callbackFunction | (xmlHttpRequest: XMLHttpRequest) => void | The function to be called when a response is received. | gatewayData | GatewayData | The gateway data for your Payment Gateway account. | env | Environment | The environment of Payment Gateway you want the request sent to. |

Returns: void

ConstgetMerchantDetails(gatewayData: GatewayData, env: Environment): Promise<XMLHttpRequest>

Parameters:

Name | Type | ------ | ------ | gatewayData | GatewayData | env | Environment |

Returns: Promise<XMLHttpRequest>


isBankDataValid

isBankDataValid(bankData: BankData): boolean

Checks if bank data could possibly be valid by doing basic validation of the account number and routing number. This function uses the Luhn Algorithm to check the account number and routing number.

NOTE: this function does not check that the account is actually valid, only that it could be valid.

Parameters:

Name | Type | Description | ------ | ------ | ------ | bankData | BankData | The card data to check. |

Returns: boolean

True if the bank could be valid, false if not.


isCardDataValid

isCardDataValid(cardData: CardData): boolean

Checks if a credit card could possibly be valid by doing basic validation of the card number, CSC, and expiration date. This function uses the Luhn Algorithm to check the card number.

NOTE: this function does not check that the card is actually valid, only that it could be valid.

Parameters:

Name | Type | Description | ------ | ------ | ------ | cardData | CardData | The card data to check. |

Returns: boolean

True if the card could be valid, false if not.


passesLuhnAlgorithm

passesLuhnAlgorithm(number: string): boolean

Checks if a number could possibly be valid by using the Luhn Algorithm. The number string passed in must contain only number characters. If there is a non-number character, there may be unexpected behaviors.

Parameters:

Name | Type | Description | ------ | ------ | ------ | number | string | The number to check as a string. |

Returns: boolean

True if the card number could be valid, false if not.


processApplePayRequest

processApplePayRequest(callbackFunction: (xmlHttpRequest: XMLHttpRequest) => void, applePayRequestParams: BuildApplePayRequestParams, env: Environment): void

Wrapper function that calls buildApplePayRequestData then processTransaction or processSubscription. See those functions for additional information. This function calls processTransaction or processSubscription even if the return value from buildTransactionRequestData is null. All error handling must be done in the callbackFunction parameter.

Parameters:

Name | Type | Description | ------ | ------ | ------ | callbackFunction | (xmlHttpRequest: XMLHttpRequest) => void | The function to be called when a response is received. | applePayRequestParams | BuildApplePayRequestParams | The payment parameters | env | Environment | The environment of Payment Gateway you want the request sent to. |

Returns: void


processApplePayTransactionRequest

processApplePayTransactionRequest(callbackFunction: (xmlHttpRequest: XMLHttpRequest) => void, paymentData: ApplePayPayment | null | undefined, gatewayData: GatewayData, amount: string, order: Order, env: Environment, customer?: Customer, lineItems?: LineItemSingle[], billTo?: BillTo): void

deprecated please use processApplePayRequest

Wrapper function that calls buildApplePayTransactionRequestData then processTransaction. See those functions for additional information. This function calls processTransaction even if the return value from buildTransactionRequestData is null. All error handling must be done in the callbackFunction parameter.

Parameters:

Name | Type | Description | ------ | ------ | ------ | callbackFunction | (xmlHttpRequest: XMLHttpRequest) => void | The function to be called when a response is received. | paymentData | ApplePayPayment | null | undefined | The argument passed into Apple's applePaySession.onpaymentauthorized function. | gatewayData | GatewayData | Your Payment Gateway partner information. | amount | string | The monetary value of the transaction being processed. This must be in the form of a number. | order | Order | An object containing the order description and invoice number. | env | Environment | The environment of Payment Gateway you want the request sent to. | customer? | Customer | An object containing customer email. | lineItems? | LineItemSingle[] | Line items you want included in the transaction. | billTo? | BillTo | Bill to information for the paying user. This parameter is optional. If it is not specified, the bill to information will be built from paymentData. |

Returns: void


processApplePayValidationRequest

processApplePayValidationRequest(callbackFunction: (xmlHttpRequest: XMLHttpRequest) => void, event: ApplePayValidateMerchantEvent | null | undefined, gatewayData: GatewayData, clientCanonicalName: string, context: string, environment: Environment): void

Wrapper function that calls buildApplePayValidationRequestData then validateApplePayRequest. See those functions for additional information. This function calls validateApplePayRequest even if the return value from buildApplePayValidationRequestData is null. All error handling must be done in the callbackFunction parameter.

Example Usage

applepaysession.onvalidatemerchant = (event) => {
    paymentGateway.processApplePayValidationRequest(
        callbackFunction,
        event,
        gatewayData,
        clientCanonicalName,
        context,
        environment
    );
}

Parameters:

Name | Type | Description | ------ | ------ | ------ | callbackFunction | (xmlHttpRequest: XMLHttpRequest) => void | The function to be called when a response is received. | event | ApplePayValidateMerchantEvent | null | undefined | The event paramenter passed in to the applepaysession.onvalidatemerchant callback. | gatewayData | GatewayData | Your Payment Gateway partner information. | clientCanonicalName | string | The client canonical name you use for Apple Pay. | context | string | The hostname of your website. | environment | Environment | The environment of Payment Gateway that you want the request set to. |

Returns: void


processGooglePayRequest

processGooglePayRequest(callbackFunction: (xmlHttpRequest: XMLHttpRequest) => void, googlePayRequestParams: BuildGooglePayRequestParams, env: Environment): void

Wrapper function that calls buildGooglePayRequestData then processTransaction or processSubscription. See those functions for additional information. This function calls processTransaction or processSubscription even if the return value from buildTransactionRequestData is null. All error handling must be done in the callbackFunction parameter.

Parameters:

Name | Type | Description | ------ | ------ | ------ | callbackFunction | (xmlHttpRequest: XMLHttpRequest) => void | The function to be called when a response is received. | googlePayRequestParams | BuildGooglePayRequestParams | The payment parameters | env | Environment | The environment of Payment Gateway you want the request sent to. |

Returns: void


processGooglePayTransactionRequest

processGooglePayTransactionRequest(callbackFunction: (xmlHttpRequest: XMLHttpRequest) => void, paymentData: PaymentData | null | undefined, gatewayData: GatewayData, amount: string, order: Order, env: Environment, customer?: Customer, lineItems?: LineItemSingle[], billTo?: BillTo): void

deprecated

Please use processGooglePayRequest

Wrapper function that calls buildGooglePayTransactionRequestData then processTransaction. See those functions for additional information. This function calls processTransaction even if the return value from buildGooglePayTransactionRequestData is null. All error handling must be done in the callbackFunction parameter.

Parameters:

Name | Type | Description | ------ | ------ | ------ | callbackFunction | (xmlHttpRequest: XMLHttpRequest) => void | - | paymentData | PaymentData | null | undefined | The object returned from Google's paymentsClient.loadPaymentData(). | gatewayData | GatewayData | Your Payment Gateway partner information. | amount | string | The monetary value of the transaction being processed. This must be in the form of a number. | order | Order | An object containing the order description and invoice number. | env | Environment | The environment of Payment Gateway you want the request sent to. | customer? | Customer | An object containing customer email. | lineItems? | LineItemSingle[] | Line items you want included in the transaction. This parameter is optional. If it is not specified, the default lineItems will be used. | billTo? | BillTo | Bill to information for the paying user. This parameter is optional. If it is not specified, the bill to information will be built from paymentData. |

Returns: void


processPayment

ConstprocessPayment(requestData: RequestData | null, gatewayData: GatewayData, env: Environment, options?: ProcessPaymentOptions): Promise<XMLHttpRequest>

Parameters:

Name | Type | ------ | ------ | requestData | RequestData | null | gatewayData | GatewayData | env | Environment | options? | ProcessPaymentOptions |

Returns: Promise<XMLHttpRequest>


processSubscription

processSubscription(callbackFunction: (xmlHttpRequest: XMLHttpRequest) => void, subscriptionData: SubscriptionData | null, env: Environment): void

Makes an HTTP request to process the subscription with Payment Gateway. When the response is received, callbackFunction is called with the XMLHttpRequest object as the parameter. The parameter subscriptionData can be generated by calling buildSubscriptionRequestData.

Parameters:

Name | Type | Description | ------ | ------ | ------ | callbackFunction | (xmlHttpRequest: XMLHttpRequest) => void | The function to be called when a response is received. | subscriptionData | SubscriptionData | null | The subscription data. | env | Environment | The environment of Payment Gateway you want the request sent to. |

Returns: void


processSubscriptionRequest

processSubscriptionRequest(callbackFunction: (xmlHttpRequest: XMLHttpRequest) => void, requestData: RequestData | null, gatewayData: GatewayData, paymentSchedule: PaymentSchedule, env: Environment, lineItems?: LineItemsRecurring[]): void

Wrapper function that calls buildSubscriptionRequestData then processSubscription. See those functions for additional information. This function calls processSubscription even if the return value from buildSubscriptionRequestData is null. All error handling must be done in the callbackFunction parameter.

Parameters:

Name | Type | Description | ------ | ------ | ------ | callbackFunction | (xmlHttpRequest: XMLHttpRequest) => void | The function to be called when a response is received. | requestData | RequestData | null | The data needed to make the request. | gatewayData | GatewayData | Your Payment Gateway partner information. | paymentSchedule | PaymentSchedule | The schedule of the recurring payment. | env | Environment | The environment of Payment Gateway you want the request sent to. | lineItems? | LineItemsRecurring[] | Line items you want included in the subscription. |

Returns: void


processTransaction

processTransaction(callbackFunction: (xmlHttpRequest: XMLHttpRequest) => void, transactionData: TransactionData | null, environment: Environment): void

Makes an HTTP request to proccess the transaction with Payment Gateway. When the response is received, callbackFunction is called with the XMLHttpRequest object as the parameter. The parameter transactionData can be generated by calling buildTransactionRequestData.

Parameters:

Name | Type | Description | ------ | ------ | ------ | callbackFunction | (xmlHttpRequest: XMLHttpRequest) => void | The function to be called when a response is received. | transactionData | TransactionData | null | The transaction data. | environment | Environment | The environment of Payment Gateway you want the request sent to. |

Returns: void


processTransactionRequest

processTransactionRequest(callbackFunction: (xmlHttpRequest: XMLHttpRequest) => void, requestData: RequestData | null, gatewayData: GatewayData, env: Environment, lineItems?: LineItemSingle[]): void

Wrapper function that calls buildTransactionRequestData then processTransaction. See those functions for additional information. This function calls processTransaction even if the return value from buildTransactionRequestData is null. All error handling must be done in the callbackFunction parameter.

Parameters:

Name | Type | Description | ------ | ------ | ------ | callbackFunction | (xmlHttpRequest: XMLHttpRequest) => void | The function to be called when a response is received. | requestData | RequestData | null | The data needed to make the request. | gatewayData | GatewayData | Your Payment Gateway partner information. | env | Environment | The environment of Payment Gateway you want the request sent to. | lineItems? | LineItemSingle[] | Line items you want included in the transaction. |

Returns: void


validateApplePayRequest

validateApplePayRequest(callbackFunction: (xmlHttpRequest: XMLHttpRequest) => void, validationData: ValidationData | null, environment: Environment): void

Validates the ValidationData that's generated via the buildApplePayValidationRequestData function by making a HTTP request to Payment Gateway. When the response is received, callbackFunction is called with the XMLHttpRequest object as the parameter. This function should be called in the applepaysession.onvalidatemerchant function that you define.

Example Usage

applepaysession.onvalidatemerchant = (event) => {
    const validationData = paymentGateway.buildApplePayValidationRequestData(
        event,
        gatewayData,
        clientCanonicalName,
        context
    );
    paymentGateway.validateApplePayRequest(callbackFunction, validationData, environment);
}

Parameters:

Name | Type | Description | ------ | ------ | ------ | callbackFunction | (xmlHttpRequest: XMLHttpRequest) => void | The function to be called when a response is received. | validationData | ValidationData | null | The validation data. | environment | Environment | The environment of Payment Gateway that you want the request set to. |

Returns: void

Interfaces

Interface: AuthData

Hierarchy

  • AuthData

Index

Properties

Properties

apiLoginID

apiLoginID: string


clientKey

clientKey: string

Interface: BankData

Hierarchy

  • BankData

Index

Properties

Properties

accountNumber

accountNumber: string


accountType

accountType: AccountType


nameOnAccount

nameOnAccount: string


routingNumber

routingNumber: string

Interface: BillTo

Hierarchy

Index

Properties

Properties

address

Optional address: undefined | string

Inherited from ShipTo.address


city

Optional city: undefined | string

Inherited from ShipTo.city


country

Optional country: undefined | string

Inherited from ShipTo.country


email

Optional email: undefined | string


faxNumber

Optional faxNumber: undefined | string


firstName

firstName: string

Inherited from ShipTo.firstName


lastName

lastName: string

Inherited from ShipTo.lastName


phoneNumber

Optional phoneNumber: undefined | string


state

Optional state: undefined | string

Inherited from ShipTo.state


zip

Optional zip: undefined | string

Inherited from ShipTo.zip

Interface: BuildApplePayRequestParams

Hierarchy

  • BuildApplePayRequestParams

Index

Properties

Properties

amount

amount: string


billTo

Optional billTo: BillTo


customer

Optional customer: Customer


gatewayData

gatewayData: GatewayData


lineItems

Optional lineItems: LineItemSingle[] | LineItemsRecurring[]


order

order: Order


paymentData

paymentData: ApplePayPayment | null | undefined


paymentSchedule

Optional paymentSchedule: PaymentSchedule


phoneNumber

Optional phoneNumber: undefined | string


preferredName

Optional preferredName: undefined | string


surcharge

Optional surcharge: ExtendedAmountType

Interface: BuildGooglePayRequestParams

Hierarchy

  • BuildGooglePayRequestParams

Index

Properties

Properties

amount

amount: string


billTo

Optional billTo: BillTo


customer

Optional customer: Customer


gatewayData

gatewayData: GatewayData


lineItems

Optional lineItems: LineItemSingle[] | LineItemsRecurring[]


order

order: Order


paymentData

Optional paymentData: PaymentData | null


paymentSchedule

Optional paymentSchedule: PaymentSchedule


phoneNumber

Optional phoneNumber: undefined | string


preferredName

Optional preferredName: undefined | string


shipTo

Optional shipTo: ShipTo


surcharge

Optional surcharge: ExtendedAmountType

Interface: CardData

Hierarchy

  • CardData

Index

Properties

Properties

cardCode

cardCode: string


cardExpiration

cardExpiration: string


cardNumber

cardNumber: string


fullname

Optional fullname: undefined | string


zip

Optional zip: undefined | string

Interface: Customer

Hierarchy

  • Customer

Index

Properties

Properties

email

email: string


phoneNumber

Optional phoneNumber: undefined | string


preferredName

Optional preferredName: undefined | string

Interface: CustomerProfile

Hierarchy

  • CustomerProfile

Index

Properties

Properties

email

Optional email: undefined | string


phoneNumber

Optional phoneNumber: undefined | string


preferredName

Optional preferredName: undefined | string

Interface: ExtendedAmountType

Hierarchy

  • ExtendedAmountType

Index

Properties

Properties

amount

amount: number


description

Optional description: undefined | string


name

Optional name: undefined | string

Interface: GatewayData

Hierarchy

  • GatewayData

Index

Properties

Properties

gatewayName

gatewayName: string


partnerName

partnerName: string

Interface: Interval

Hierarchy

  • Interval

Index

Properties

Properties

length

length: string


unit

unit: "DAYS" | "MONTHS"

Interface: LineItemSingle

Hierarchy

  • LineItemSingle

Index

Properties

Properties

itemId

itemId: string


name

name: string


quantity

quantity: number


unitPrice

unitPrice: number

Interface: LineItemsRecurring

Hierarchy

  • LineItemsRecurring

Index

Properties

Properties

amount

amount: number


description

description: string


itemCode

itemCode: string


name

name: string

Interface: LineItemsSingle

Hierarchy

  • LineItemsSingle

Index

Properties

Properties

lineItem

lineItem: LineItemSingle[]

Interface: Order

Hierarchy

  • Order

Index

Properties

Properties

description

description: string


invoiceNumber

invoiceNumber: string

Interface: ParsedCardData

Hierarchy

  • ParsedCardData

Index

Properties

Properties

cardCode

cardCode: string


cardNumber

cardNumber: string


fullname

Optional fullname: undefined | string


month

month: string


year

year: string


zip

Optional zip: undefined | string

Interface: Payment

Hierarchy

  • Payment

Index

Properties

Properties

opaqueData

opaqueData: any

Interface: PaymentSchedule

Hierarchy

  • PaymentSchedule

Index

Properties

Properties

interval

interval: Interval


startDate

startDate: string


totalOccurrences

totalOccurrences: string

Interface: ProcessPaymentOptions

Hierarchy

  • ProcessPaymentOptions

Index

Properties

Properties

lineItems

Optional lineItems: LineItemsRecurring[] | LineItemSingle[]


paymentSchedule

Optional paymentSchedule: PaymentSchedule

Interface: RequestData

Hierarchy

Index

Properties

Properties

amount

amount: string


billTo

billTo: BillTo


customer

customer: Customer


order

order: Order


payment

payment: Payment


phoneNumber

Optional phoneNumber: undefined | string


preferredName

Optional preferredName: undefined | string


shipTo

Optional shipTo: ShipTo


surcharge

Optional surcharge: ExtendedAmountType

Interface: RequestDataParams

Hierarchy

  • RequestDataParams

Index

Properties

Properties

amount

amount: string


billTo

billTo: BillTo


customer

customer: Customer


order

order: Order


phoneNumber

Optional phoneNumber: undefined | string


preferredName

Optional preferredName: undefined | string


response

response: any


shipTo

Optional shipTo: ShipTo


surcharge

Optional surcharge: ExtendedAmountType

Interface: SecureData

Hierarchy

  • SecureData

Index

Properties

Properties

authData

authData: AuthData


bankData

Optional bankData: BankData


cardData

Optional cardData: ParsedCardData

Interface: ShipTo

Hierarchy

Index

Properties

Properties

address

Optional address: undefined | string


city

Optional city: undefined | string


country

Optional country: undefined | string


firstName

firstName: string


lastName

lastName: string


state

Optional state: undefined | string


zip

Optional zip: undefined | string

Interface: SubscriptionData

Hierarchy

  • SubscriptionData

Index

Properties

Properties

customerProfile

Optional customerProfile: CustomerProfile


gatewayData

gatewayData: GatewayData


lineItems

lineItems: LineItemsRecurring[]


subscription

subscription: SubscriptionRequest

Interface: SubscriptionRequest

Hierarchy

Index

Properties

Properties

amount

amount: string

Inherited from RequestData.amount


billTo

billTo: BillTo

Inherited from RequestData.billTo


customer

customer: Customer

Inherited from RequestData.customer


order

order: Order

Inherited from RequestData.order


payment

payment: Payment

Inherited from RequestData.payment


paymentSchedule

paymentSchedule: PaymentSchedule


phoneNumber

Optional phoneNumber: undefined | string

Inherited from RequestData.phoneNumber


preferredName

Optional preferredName: undefined | string

Inherited from RequestData.preferredName


shipTo

Optional shipTo: ShipTo

Inherited from RequestData.shipTo


surcharge

Optional surcharge: ExtendedAmountType

Inherited from RequestData.surcharge

Interface: TransactionData

Hierarchy

  • TransactionData

Index

Properties

Properties

customerProfile

Optional customerProfile: CustomerProfile


gatewayData

gatewayData: GatewayData


transactionRequest

transactionRequest: TransactionRequest

Interface: TransactionRequest

Hierarchy

Index

Properties

Properties

amount

amount: string

Inherited from RequestData.amount


billTo

billTo: BillTo

Inherited from RequestData.billTo


customer

customer: Customer

Inherited from RequestData.customer


lineItems

lineItems: LineItemsSingle


order

order: Order

Inherited from RequestData.order


payment

payment: Payment

Inherited from RequestData.payment


phoneNumber

Optional phoneNumber: undefined | string

Inherited from RequestData.phoneNumber


preferredName

Optional preferredName: undefined | string

Inherited from RequestData.preferredName


shipTo

Optional shipTo: ShipTo

Inherited from RequestData.shipTo


surcharge

Optional surcharge: ExtendedAmountType

Inherited from RequestData.surcharge


transactionType

transactionType: string

Interface: ValidationData

Hierarchy

  • ValidationData

Index

Properties

Properties

clientCanonicalName

clientCanonicalName: string


context

context: string


gatewayData

gatewayData: GatewayData


validationUrl

validationUrl: string