Title: Commas?
Last modified: August 21, 2016

---

# Commas?

 *  [castle9mm](https://wordpress.org/support/users/castle9mm/)
 * (@castle9mm)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/commas/)
 * I’m seeing issues with commas in the amount field. When a donation is entered
   as $1000 the transaction goes through just fine. When a user enters $1,000 the
   transaction is actually processed as one dollar. This happened in Live & Test
   mode with Stripe so it should be easy to duplicate if anyone else is having the
   issue.
 * [http://wordpress.org/plugins/wp-stripe/](http://wordpress.org/plugins/wp-stripe/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [erikfrick](https://wordpress.org/support/users/erikfrick/)
 * (@erikfrick)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/commas/#post-4100179)
 * I’m having this same issue. My guess is that it has to do with the validation
   of the information. I still need to test this, but my theory is that the wp-stripe.
   js file, line 60 is breaking when it encounters a comma in the field. That line
   is converting the amount to charge into cents.
 * A quick test in the JS console shows that:
    `1,000 * 100 = 0`
 * but that:
    `1000 * 100 = 100000`
 * Again, I still need to test this out, but I sure hope it’s as simple as that.
 *  [erikfrick](https://wordpress.org/support/users/erikfrick/)
 * (@erikfrick)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/commas/#post-4100180)
 * Ok, my initial theory was only slightly wrong. I thought it was a JS validation
   issue, when it was really an issue with PHP validation. Yeesh! Follow instructions
   below to fix the issue.
 * In your wp-stripe plugin folder open the stripe-functions.php file in the ‘includes’
   folder. Go down to lines 118-121 or so, you’ll see something like this:
 *     ```
       $public = $_POST['wp_stripe_public'];
       $name = $_POST['wp_stripe_name'];
       $email = $_POST['wp_stripe_email'];
       $amount = str_replace('$', '', $_POST['wp_stripe_amount']) * 100;
       $card = $_POST['stripeToken'];
       ```
   
 * Change that block to:
 *     ```
       $public = $_POST['wp_stripe_public'];
       $name = $_POST['wp_stripe_name'];
       $email = $_POST['wp_stripe_email'];
       $amount = str_replace(',', '', $_POST['wp_stripe_amount']);
       $amount = str_replace('$', '', $amount) * 100;
       $card = $_POST['stripeToken'];
       ```
   
 * Basically, all we’re doing is stripping out commas from the string before we 
   strip out the dollar signs and convert the dollar amount to cents (that’s how
   Stripe likes it’s amounts).
 *  [greg.blass](https://wordpress.org/support/users/gregblass-1/)
 * (@gregblass-1)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/commas/#post-4100199)
 * To me this is a serious bug!
 * My client just typed in 1,925 in a live environment and got charged $1.00
 *  [greg.blass](https://wordpress.org/support/users/gregblass-1/)
 * (@gregblass-1)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/commas/#post-4100200)
 * The above code from erikfrick fixes the problem. This should be merged into the
   latest version.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Commas?’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-stripe_ececec.svg)
 * [WP Stripe](https://wordpress.org/plugins/wp-stripe/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-stripe/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-stripe/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-stripe/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-stripe/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-stripe/reviews/)

## Tags

 * [comma](https://wordpress.org/support/topic-tag/comma/)
 * [symbols](https://wordpress.org/support/topic-tag/symbols/)

 * 4 replies
 * 3 participants
 * Last reply from: [greg.blass](https://wordpress.org/support/users/gregblass-1/)
 * Last activity: [12 years, 4 months ago](https://wordpress.org/support/topic/commas/#post-4100200)
 * Status: not resolved