Fee Calculation Functions

Plugin icon

Fee Calculation Functions

calculateMerchantFeeForPaymentPlan

This method calculates the MFFP price depending on country, state, currency and amount.

The calculateMerchantFeeForPaymentPlan() method returns a promise with the below parameters.

Attribute NameTypeDescription
adjustedOrderAmountnumberThe new order amount, including the MFPP fee.
currencystring‘Amount’ currency
merchantFeeForPaymentPlannumberThe per-order fee amount, set as part of the customer contribution model.

Code Example:

window.quadpay.merchantFees.calculateMerchantFeeForPaymentPlan({
merchantId: "44444444-4444-4444-4444-444444444444",
customerState: "NY",
customerCountry: "US",
amount: 100,
currency: "USD"}).then((response) => {
  //response.adjustedOrderAmount
  //response.currency
  //response.merchantFeeForPaymentPlan
});

calculateInstallments

This method takes a number value as a parameter and returns an array with 4 items — each installment amount based on the order amount.

Attribute NameTypeDescription
amountnumberThe new order amount, including the MFPP fee.
datestringe.j., Wed Jul 14 2021 00:00:00 GMT-0400 (Eastern Daylight Time)
sequenceNumbernumberThe installment sequence.

Code Example:

var installments = window.quadpay.calculateInstallments(100);

Order in Json Format

order = {
  amount: 166.00,
  currency: 'USD',
  merchantReference: 'your-unique-order-id',
  shippingAmount: 10.00,
  taxAmount: 5.50,
  customer: {
    address1: '123 street ',
    address2: '',
    city: 'New York',
    state: 'NY',
    postalCode: '10000-4311',
    country: 'US',
    email: [email protected]',
    firstName: 'John',
    lastName: 'Doe',
    phoneNumber: '+11111111111'
    },
  lineItems: [
    {
    name: 'Item Name 1',
    description: 'Item description 1',
    quantity: 1,
    price: 100.25,
    sku: '8000148',
    isPreOrder: false,
    releaseDate: '2023-10-10',
    },
    {
    name: 'Item Name 2',
    description: 'Item description 2',
    quantity: 1,
    price: 50.25,
    sku: '8000149',
    isPreOrder: false,
    releaseDate: '2023-10-10',
    },
    ]
    };