5

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.

9
  • 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 decimal Commented Oct 6, 2015 at 11:10
  • thanks @DTing... I've checked but its not working Commented Oct 6, 2015 at 11:15
  • 1
    hmmm ... why don't you use ng-model? Commented Oct 6, 2015 at 11:29
  • I've used that too...but no luck Commented Oct 6, 2015 at 11:30
  • 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 ... Commented Oct 6, 2015 at 11:33

1 Answer 1

4

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);
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.