Developers

Request API Access

Already have access? Login

Quick and Easy Implementation

  • 1

    Let's get a Paydunk button up and running on your merchant site! To get started we'll need a few things from you: The first of these is a simple website that you'll create to accept payments from Paydunk users' credit cards. It is important that the website is secure (sent over HTTPS instead of HTTP) and is able to do three relatively simple tasks: Accept a POST request from our mobile app, process a transaction with the information received, and send a PUT request to our API to close the transaction process.

    It's simpler than it sounds, really! Make sure you set up your page to receive POST requests in the following format:

    POST https://your_payment_acceptance_domain

    -"expiration_date": "01/20", // string - expiration date on card. Format: MM/YY
    -"card_number": "1111111111111111", //- string - credit card number
    -"cvv": "123", // string - 3-4 digit code found on back of card
    -"shipping_first_name": "Rolo", // string - first name
    -"shipping_last_name": "Tomassi", // string - last name
    -"shipping_email": "rolo.tomassi@test.com", // string - email
    -"shipping_address_1": "Some Address", // string - address line one
    -"shipping_address_2": "A", // string (optional) - address line two
    -"shipping_city": "New York", // string - city name
    -"shipping_state": "NY", // string - state abbreviation
    -"shipping_zip": "10006" // string - 5 digit postal code
    -"billing_first_name": "Kaiser", // string - first name
    -"billing_last_name": "Sose", // string - last name
    -"billing_email": "kaiser.sose@test.com", // string - email
    -"billing_phone": "1-111-1111", // string - phone
    -"billing_address_1": "Some Addres", // string - address line one
    -"billing_address_2": "B", // string (optional) - address line two
    -"billing_city": "New York", // string - city name
    -"billing_state": "NY", // string - state abbreviation
    -"billing_zip": "10006" // string - 5 digit postal code
    -"email": "test@test.com", // string - email address of paydunk user associated with transaction
    -"transaction_uuid": "2e6bde48-ad8d-11e4-9b26-b8e856352ede" // string - 36 digit uuid number of the transaction
    -"order_number": "14324" // string - order number created by merchant site in order to perform transaction
    							

    Once this information is received, you are free to perform the transaction however you best see fit.

    After you've run the credit card transaction, you'll need to tell us about the result. To do this you'll send a PUT request to our Paydunk API. The request should be sent in the following format:

    PUT https://api.paydunk.com/api/v1/transactions/{transaction_uuid}

    body params: {
    	"client_id", // string - Your App ID
    	"client_secret", // string - Your App Secret
    	"status", // string - must be "success", "cancelled", or "error" depending on the outcome of your transaction.
    }
    							

    You'll receive the transaction_uuid in the above URL in the earlier POST request. We'll worry about the client_id and the client_secret in the next step.

    Once this site is up, we're ready to get a Paydunk button on your site! To do this you'll need to register an application with us.

  • 2

    To register an application, click on the Create Application button you see above. You'll be prompted to give an application name as well as the URL of the payment acceptance site you created above. THESE ARE REQUIRED FIELDS. You may also add a redirect URL to your application. This will be where the user is redirected to after their transaction is successful (usually some sort of results page.) If you do NOT add a redirect URL, then the Paydunk window will stay open after a transaction is completed, displaying its own results window. Submit this information and an application will be created for your account. Check in the Applications tab view all of your apps. You'll see each of your apps are given an App ID and an App Secret. Make sure to keep the App Secret a secret! These two strings are what you'll use as client_id and client_secret in the above PUT call to our Paydunk API.

  • 3

    To put the Paydunk Checkout Button on your site, you'll need to add the following pieces to the html on your checkout page.

    Add this script to the <head></head> section of your site:

    <head>
    …
    <script type="text/javascript">
        var paydunkInit = {
            appID: '8yLu2RIyxkkiktQCrwJNbdpzd3Fz28ErvzCxYkaN',
            version: '1.0.0'
        };
    
        window.onload = function() {
            (function(d, s, id, st, r) {
                var js,
                stylesheet,
                fjs = d.getElementsByTagName(s)[0];
    
                // check if element with id="paydunk-jssdk" already exist
                if (d.getElementById(id)) {return;}
    
                // create new DOM elements
                js = d.createElement(s);
                js.id = id;
                js.src = "https://api.paydunk.com/js/paydunkSignin.js";
    
                stylesheet = d.createElement(st);
                stylesheet.rel = r;
                stylesheet.href = "https://api.paydunk.com/css/login.css";
    
                // insert DOM elements
                fjs.parentNode.insertBefore(js, fjs);
                fjs.parentNode.insertBefore(stylesheet, fjs);
            }(document, 'script', 'paydunk-jssdk', 'link', 'stylesheet'));
        }
    </script>
    ...
    </head>
    						

    This script will style the Paydunk Checkout Button and create an iframe on your page to display the transaction initiation process. Make sure you put your App ID in the spot where it says ‘your_app_id_here' in the above code!

    Finally, we need to add the markup in your page to create a spot for the Paydunk Checkout Button.

    <body>
    …
        <button type="button" id="pd-paydunkButton"></button>
    
        <form>
            <input type="hidden" id="pd-client_id" name="client_id" />
            <input type="hidden" id="pd-order_number" name="order_number" />
            <input type="hidden" id="pd-price" name="price" />
            <input type="hidden" id="pd-tax" name="tax" />
            <input type="hidden" id="pd-shipping" name="shipping" />
        </form>
    
    ...
    </body>
    						

    You'll notice that you need to fill in the values of the order number and the transaction price in your form inputs.

  • 4

    Oh you're ready to Paydunk!