0

I'm implementing the Credit Card Payment form of PAYMILL according to the Payment Form docu. So I copied the JS from the Bridge docu page and the form from the Payment Form docu page.

The problem is: curretly I can use only the dot as amount delimiter symbol. But in the region the shop is being developed for comma is used as separator in amount.

What and how should be configured, in order to give users the ability to use comma as delimiter symbol for amounts?


UPDATE:

Here is an example from the PAYMILL website (https://www.paymill.com/en-gb/#/demo-payment-form -- just click on "Demo Payment Form"). It works with comma:

Here

enter image description here

automatix
  • 14,018
  • 26
  • 105
  • 230

1 Answers1

0

You should not use any delimiter for the amount. The field is deprecated. Use "amount_int", which is the amount in cents. E.g. for 1,50€ you should have "amount": 150.

stoilkov
  • 1,686
  • 1
  • 11
  • 18
  • Thank you for your answer! When you say "you should not use any delimiter for the amount", maybe you mean the amount sent to PAYMILL via `cURL`. Yes, this value needs to be an integer and a multiplication of the user input with `100`. (See [this PAYMILL example](https://github.com/paymill/paymill-payment-form/blob/master/payment.php#L34) on GitHub.) But the PAYMILL form allows delimiter. How schould I say to my users, that they should type in `€1234` instead of `€12,34`. And it works with the delimiter. But how to define another symbol than `.` as delimiter? – automatix Jun 09 '14 at 08:34
  • Are you using the form for some kind of donation (where the user will input the amount) ? You have to use the amount twice, once in the JS createToken(), which generates the token and once in your backend (e.g. PHP, Java) when creating the actual transaction. For the JS part you should use amount_int as a parameter, it expects the value to be in cents (as does the transaction API endpoint). – stoilkov Jun 09 '14 at 10:41
  • If you want to "convert" decimals to integers in cents, why just not multiply by 100 ? – stoilkov Jun 09 '14 at 10:42
  • I think, you don't understand, what I mean. I just want to let users do a normal input with delimiter for amaount. It works with a dot, but does not with a comma. Please see the answer update, I added an image. – automatix Jun 09 '14 at 13:54
  • In Javascript the decimal delimiter is '.' so you can just do something like var amountInCents=parseFloat(inputAmount)*100 . If you want it be more precise (e.g. someone typing in 1,2345), you can use the toFixed() function: var amountInCents=parseFloat(parseFloat(inputAmount).toFixed(2))*100 – stoilkov Jun 11 '14 at 06:46