jcberquist/stripe-cfml

convertToCents and application_fee issue

Closed this issue · 2 comments

You will get an error after setting application_fee on response with convertToCents enabled. Line 654 tries to convert application_fee to cents again, but on response application_fee is no longer numeric but a stripe transaction id.

Basically to fix it change this:

if ( variables.convertToCents && arrayFindNoCase( variables.currencyFields, key ) ) result[ key ] = result[ key ] / 100;

To this:

if ( variables.convertToCents && arrayFindNoCase( variables.currencyFields, key ) && isNumeric(result[ key ]) ) result[ key ] = result[ key ] / 100;

Just makes sure it's numeric before it does the deed.

Thanks for catching this, and for providing a fix.