5
votes

I am integrating paypal gateway in my angularjs app. In that I am submitting form with various input field. In that form, I am setting up value of amount dynamically
For example: <input type="hidden" name="amount" value="{{paypal_data.reward_amount}}">
But paypal is not accepting form and displaying following error.

The link you have used to enter the PayPal system contains an incorrectly formatted item amount.

The value is setting to amount successfully. When I use input type= "text" instead of "hidden" then its displaying correct value in textbox but paypal is not accepting form. How to set value dynamically to input with another method so that the form will accept by paypal.

1
I'm not sure if this is your problem but paypal accepts only 2 decimal places for the amount, check if paypal_data.reward_amount only has 2 places after the decimaldting
thanks @DTing... I've checked but its not workingOmkar
hmmm ... why don't you use ng-model?David Votrubec
I've used that too...but no luckOmkar
And do you use angular to post it? Or do you call form.submit(). Because if you use angular, then it should work correctly. The value="{{}}" is kinda weird ...David Votrubec

1 Answers

4
votes

I've fixed this by applying some logic. I used below JQuery code
setTimeout(function(){},100);
I've submitted the form by applying some delay using function.
I think when I using only $("#paybtn").click(); //Automatic Button Click function it was submitting form before assigning value to input. Finally I used below code that worked successfully to me

setTimeout(function(){ $("#paybtn").click(); },0);