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.
The argument passed into Apple's `applePaySession.onpaymentauthorized`
function.
Your Payment Gateway partner information.
The monetary value of the transaction being processed. This must be in
the form of a number.
An object containing customer email.
An object containing the order description and invoice number.
Line items you want included in the transaction.
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.
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.
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.
The event paramenter passed in to the applepaysession.onvalidatemerchant
callback.
Your Payment Gateway partner information.
The client canonical name you use for Apple Pay.
The hostname of your website.
If event is null or missing property validationURL, null is returned.
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.
The object returned from Google's `paymentsClient.loadPaymentData()`.
Your Payment Gateway partner information.
The monetary value of the transaction being processed. This must be in
the form of a number.
An object containing customer email.
An object containing the order description and invoice number.
Line items you want included in the transaction. This parameter is
optional. If it is not specified, the default `lineItems` will be used.
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.
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.
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
The response body as JavaScript object from the call to AcceptJS.
The amount to be payed.
The payee's billing information.
The payee's customer information.
The order description and invoice number.
The shipping information for the payment.
If response is null or it does not contain opaqueData, null is
returned.
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.
The data needed to make the request.
Your Payment Gateway partner information.
The schedule of the recurring payment.
Line items you want included in the transaction.
If requestData is null, null is returned.
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.
The data needed to make the request.
Your Payment Gateway partner information.
Line items you want included in the transaction.
If requestData is null, null is returned.
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.
The response body as a JavaScript object from HTTP request in
`getMerchantDetails`.
Your Authorize.NET API key.
The card or bank payment data that will be used for the request.
If response is void or does not have publicClientKey, null is
returned.
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.
The function to be called when a response is received.
The gateway data for your Payment Gateway account.
The environment of Payment Gateway you want the request sent to.
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.
The card data to check.
True if the bank could be valid, false if not.
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.
The card data to check.
True if the card could be valid, false if not.
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.
The number to check as a string.
True if the card number could be valid, false if not.
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.
The function to be called when a response is received.
The argument passed into Apple's `applePaySession.onpaymentauthorized`
function.
Your Payment Gateway partner information.
The monetary value of the transaction being processed. This must be in
the form of a number.
An object containing customer email.
An object containing the order description and invoice number.
The environment of Payment Gateway you want the request sent to.
Line items you want included in the transaction.
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.
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
);
}
The function to be called when a response is received.
The event paramenter passed in to the applepaysession.onvalidatemerchant
callback.
Your Payment Gateway partner information.
The client canonical name you use for Apple Pay.
The hostname of your website.
The environment of Payment Gateway that you want the request set to.
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.
The object returned from Google's `paymentsClient.loadPaymentData()`.
Your Payment Gateway partner information.
The monetary value of the transaction being processed. This must be in
the form of a number.
An object containing customer email.
An object containing the order description and invoice number.
The environment of Payment Gateway you want the request sent to.
Line items you want included in the transaction. This parameter is
optional. If it is not specified, the default `lineItems` will be used.
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.
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 transactionData
can
be generated by calling buildSubscriptionRequestData.
The function to be called when a response is received.
The subscription data.
The environment of Payment Gateway you want the request sent to.
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.
The function to be called when a response is received.
The data needed to make the request.
Your Payment Gateway partner information.
The schedule of the recurring payment.
The environment of Payment Gateway you want the request sent to.
Line items you want included in the transaction.
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.
The function to be called when a response is received.
The transaction data.
The environment of Payment Gateway you want the request sent to.
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.
The function to be called when a response is received.
The data needed to make the request.
Your Payment Gateway partner information.
The environment of Payment Gateway you want the request sent to.
Line items you want included in the transaction.
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);
}
The function to be called when a response is received.
The validation data.
The environment of Payment Gateway that you want the request set to.
Generated using TypeDoc, the 7/23/2020 at 11:27:31 AM
The default transaction type that is set in buildTransactionRequestData, buildGooglePayTransactionRequestData, and buildApplePayTransactionRequestData for TransactionRequest.transactionType.