MachinepackCalculations.productPriceV2()

Calculate final price when user does not assume any fee.

Calculate final price when user does not assume any fee.

Usage

Hover over inputs/exits for more info.

var MachinepackCalculations = require('machinepack-calculations');


// Calculate final price when user does not assume any fee.

MachinepackCalculations.productPriceV2({

originalPrice: 200.23,

stripePercent: 2.9,

stripeFlat: 0.3,

paidUpFee: 5,

discount: 20,

payProcessing: false,

payCollecting: true,

type: 'bank',

capAmount: '456',

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// OK.

success: function (result) {

 

},

});

Inputs

originalPrice required

Price base for calculate owed price.

200.23
stripePercent required

Percentage for calculate stripe fee.

2.9
stripeFlat required

Amount base to calcualte stripe fee.

0.3
paidUpFee required

Percentage to calculate Paid Up Fee.

5
discount required

Percentage to discount at original price

20
payProcessing required

This parameter define if user pay stripe processing

false
payCollecting required

This parameter define if user pay PadUp processing

true
type

Type of entity.

'bank'
capAmount

Amount limit for choose a kind of calculation.

'456'

Exits

error

An unexpected error occurred.

success

OK.

{ version: 'v2',
  basePrice: 200,
  originalPrice: 300,
  totalFee: 12,
  owedPrice: 343.44,
  discount: 12,
  feePaidUp: 8.12,
  feeStripe: 3.23 }