How to use "Pay API Example"

I see it working fine in the iframe of this page:
But i cant get it working when i use the wix editor/preview
the error i get is:
Uncaught (in promise) Error: WixPayBackend.createPayment: can’t create payment, details:
Total amount should be the sum of the item amounts