1

I am using a payments API in my application and am getting the invoice value with type number

signature.invoice.amount: 10500 (Number)

I tried to use currency pipe {{ signature.invoice.amount | currency: 'BRL': true}} and the transformed value is: $ 10,500.00.

But the transformed value should be $ 105.00 ... how do I get the number of the amount received to a monetary value in 'BRL' with a return of the number type?

1 Answer 1

1

Since $105.00 is 10,500 cents, you want to convert it to dollars before transforming it:

{{ signature.invoice.amount / 100 | currency: 'BRL': true}}

Good job storing currency as cents though! That's the way to do it to save yourself errors down the line.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.