www.webdeveloper.com
Results 1 to 4 of 4

Thread: Custom Stripe Button

  1. #1
    Join Date
    Jun 2013
    Posts
    38

    Custom Stripe Button

    Stripe has an easy pay with card button. I want to hack it so I can pass a custom amount to it. (It defaults to 20)

    The site currently under construction is http://pecosselfstorage.com/testpayments.html

    I need the customer to be able to put in however much they want to pay. Whether this is in the pop-up after they click the button, or on the page next to the button doesn't matter much. I'd prefer it to be in the pop-up however.

    Please don't just post links to Stripe's site, I've been through all of that and can't find any help there.

    Any thoughts are welcome. Thanks!

  2. #2
    Join Date
    Mar 2011
    Posts
    1,148
    There's no (reasonable) way to hack Stripes checkout.js file for the "Pay With Card" button to add adjustable payment amounts in the form in their pop-up. If you use the Custom Button method, it might be possible to pass the amount from an <input> box on your page to the JavaScript that creates their pop-up.

  3. #3
    Join Date
    Jun 2013
    Posts
    38
    Quote Originally Posted by rtrethewey View Post
    If you use the Custom Button method, it might be possible to pass the amount from an <input> box on your page to the JavaScript that creates their pop-up.
    Well I know you can customize the button to do certain things, and the input box was one of the ideas I'm looking at. My question is, How do I do that?

  4. #4
    Join Date
    Mar 2011
    Posts
    1,148
    I was originally thinking you could use an onchange() function on an <input> box and somehow update the amount for the button, but now I don't think there's a practical way to make that work. I think you're probably going to have to use a two-step process. Step one is to get the user to enter an amount and click on a button which will call the Stripe JavaScript code that creates the button. Then step two is to have the user click on the "Pay Now" button that calls the pop-up window.

    The Stripe code depends on knowing the amount at the time their <script> tag is processed by the browser. That's fine if you want to have a "Buy Now" button for a single fixed-price item or if you have a shopping cart system on your site that can incorporate the amount into the <script> tag when the page is served to the user. So incorporating a user-settable amount is going to require some software - either JavaScript or server-side software. I don't have the time just now to create some sample code, but maybe someone else here will.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles