1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

stripe/braintree - help a brother out

Discussion in 'HTML, Graphics & Programming' started by Fairly sure the answer is no, Oct 26, 2018.

  1. Fairly sure the answer is no

    Sgarrista

    Joined: Feb 12, 2006

    Posts: 9,044

    Location: Surrey

    i've been struggling with this for the past week. i actually attempted it a year ago and got no where so put it on the todo list, but i'm currently trying again with no real progress for the time it's taken.

    i've been at it with stripe for the most part, trying to get this set up with a nice form, but i'm finding a straight forward guide that applies to my site with no framework impossible to locate.

    can someone please help me out.

    is it possible to have something like stripe, or preferably braintree (as i hear better things about it) added to a site that has no shopping cart, no wordpress, no framework etc? it's just a custom made site that i want to add a payment section to on a standard form

    i've made some improvement to this page that are only local, but essentially it's the link below where there would be a payment form included. the user would have been given a price before visiting this page with a quote ref, which knows the total amount and would be able to be fed to the payment form.

    https://www.mayercleaning.co.uk/book-online/cleaning/?service=moving

    is this doable? if so, any suggestions as to a simple guide that works for me? everyone i try, like the following link, acts as though you're all set by showing you a small bit of code, but leaves out that it's for some framework and i've just wasted half a day figuring that out.

    https://codepen.io/rcdexta/pen/eZPbzB
     
  2. Cromulent

    Mobster

    Joined: Nov 1, 2007

    Posts: 2,779

    What language is the website written in? Just find the Stripe or Braintree SDK for that language, and it will tell you everything you need to know to integrate it with your website backend.
     
  3. rainbowGuy

    Gangster

    Joined: Dec 19, 2016

    Posts: 126

    the workflow is simple, you show the price, include a SDK (JS) for stripe.. which opens a modal where user enters their card/address and then pres submit, js does its stuff and then redirects to a URL that you create with a stripe token - you then use this to actually charge the customer & redirect to the thank you page..
    you can also store users cust token and then charge user again instead of getting user to enter their card..
     
  4. Fairly sure the answer is no

    Sgarrista

    Joined: Feb 12, 2006

    Posts: 9,044

    Location: Surrey

    thanks. i've google braintree sdk php but what i'm finding says i need this or that framework?
     
  5. UberTiger

    Mobster

    Joined: Nov 1, 2008

    Posts: 2,817

  6. Fairly sure the answer is no

    Sgarrista

    Joined: Feb 12, 2006

    Posts: 9,044

    Location: Surrey

  7. touch

    Capodecina

    Joined: Oct 28, 2006

    Posts: 10,617

    Location: Sufferlandria

    If you're not sure what you're doing, go for a hosted payment gateway rather than an integrated solution on your own site (eg, direct users to paypal website to enter payment info and redirect back after payment).
    Payment is something you really need to do right. If you get it wrong, that could be anything from overcharging/double-charging to leaking card details to a third-party.

    You'll probably also need to have a PCI-compliant server for the site if you're handling card details (even if you only take those card details and pass them to some payment API without storing them).
     
  8. Fairly sure the answer is no

    Sgarrista

    Joined: Feb 12, 2006

    Posts: 9,044

    Location: Surrey

    i'm sure i can do this on my site, it's just the guides are imo not clear at all. the guides will show you only half the code actually required
     
  9. touch

    Capodecina

    Joined: Oct 28, 2006

    Posts: 10,617

    Location: Sufferlandria

    Yes, I'm sure you can do it.
    Are you also sure that your code is secure? Not just the code which submits the payment, but the entire site. Nobody will be able to find a vulnerability and sniff the card details you're passing around?
     
  10. Fairly sure the answer is no

    Sgarrista

    Joined: Feb 12, 2006

    Posts: 9,044

    Location: Surrey

    no more or less than any other wordpress/cart style site i guess. i feel we've got some basic good security, but always open to improving.

    i was under the impression the great thing about these services is that they are secure, that they deal with all the details and security of the input fields etc
     
  11. sb89

    Gangster

    Joined: May 24, 2011

    Posts: 241

  12. touch

    Capodecina

    Joined: Oct 28, 2006

    Posts: 10,617

    Location: Sufferlandria

    Maybe I havn't understood what you're trying to do.
    Your OP said you wanted to add a payment section to a "standard form". I assumed that meant you wanted to accept the payment details through your own site and pass them to an API somewhere to process the payment.
    Looking at the example @sb89 posted for how the braintree web drop in works, that's different to what I was expecting (it opens a popup window where you enter the payment details).

    If you have the payment fields on your own site, any code anywhere on your page can access those fields so your entire page code needs to be secure.

    If you use the popup window option, your code can't access any of the user input fields there so security from your side is less important.
     
  13. Fairly sure the answer is no

    Sgarrista

    Joined: Feb 12, 2006

    Posts: 9,044

    Location: Surrey

    it doesn't as there's still code missing.

    the official documentation seems unneccesarily complex, but then any guide there is skips steps.

    it's odd as usually i'd expect to find someone with a guide, but also with the files to download, then you just copy paste the bits into the correct place, editing the id and keys, and done.

    but not with braintree it seems
     
  14. touch

    Capodecina

    Joined: Oct 28, 2006

    Posts: 10,617

    Location: Sufferlandria

    That page has everything you need. Use developer tools to look at the code on the page, not a separate reference guide.
    Look through the code to see all of the options they've used and just edit it to fit your own requirements.
    Here's a cut-down version with the minimum you need to make it work:
    Code:
    <script src="https://js.braintreegateway.com/web/dropin/1.13.0/js/dropin.min.js"></script>
    <script>
    braintree.dropin.create({
        authorization: 'sandbox_f252zhq7_hh4cpc39zq4rgjcg',
        container: '#dropin-container'
    }, callback);
    function callback(){}
    </script>
    <div id="dropin-container"></div>