Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
..
Failed to load latest commit information.
README.md
plugin_screenshot_1.jpg
screen_1.png

README.md

If your Wordpress website is using Woocommerce, our Wordpress plugin is ready for you.

a. Contact us support@checkbook.io for Wordpress Plugin.

b. After you install both Woocommerce and Checkbook's plugins, activate them.

Installed Plugin

c. Go to Woocommerce => Setting => Checkout

Config Plugin

d. Fill out all the necessary information

Use Checkbook without a Wordpress Plugin (Production Version)

a. Edit a page or a post that you want to have the PAY BUTTON there.

<code>
    <form id="checkbook_io" method="POST">
        <input type="hidden" id="checkbook_var"
            data-key="PUBLISHABLE KEY"
            data-amount='100'
            data-name="Merchant Name"
            data-for="Merchant Name"
            data-description="Your item's description"
            data-user-email ='buyer_email_address@example.com'
            data-redirect-url ="https://example.com/callback"          
            data-firstName ='Buyer First Name'
            data-lastName ='Buyer Last Name'
            data-env ='prod'/>
        <script src="https://www.checkbook.io/static/api/v1/checkbook.js" class="checkbook-button" id="checkbook_api_js">
        </script>
    </form>
</code>

Please update data-redirect-url to your domain callback page.

b. Create a redirect page, e.g. callback.php

<?php
//get the form elements and store them in variables
$url = 'https://www.checkbook.io/api/v1/charge';
$token=$_POST["token"]; 
$amount=$_POST["amount"] * 100;
$secret_key='your checkbook secret key'; 

$fields = array(
    'token' => $token,
    'amount' => $amount,
    'key' => $secret_key,
    );

//url-ify the data for the POST
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string, '&');

//open connection
$ch = curl_init();

//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);

//execute post
$result = curl_exec($ch);
$http_code = curl_getinfo($ch)["http_code"];
echo $http_code;

if( $http_code == 200){
    /* Direct users to the payment success page. */
    echo "<script>
            window.location.assign('https://www.example.com/success.html')
         </script>";
} else {
    /* Direct users to the payment failure page. */
    echo "<script>
            window.location.assign('https://www.example.com/failure.html')
         </script>";
}
//close connection
curl_close($ch);
?>

Use Checkbook without a Wordpress Plugin (Sandbox Version)

a. Edit a page or a post that you want to have the PAY BUTTON there.

<code>
    <form id="checkbook_io" method="POST">
        <input type="hidden" id="checkbook_var"
            data-key="PUBLISHABLE KEY"
            data-amount='100'
            data-name="Merchant Name"
            data-for="Merchant Name"
            data-description="Your item's description"
            data-user-email ='buyer_email_address@example.com'
            data-redirect-url ="https://example.com/callback"          
            data-firstName ='Buyer First Name'
            data-lastName ='Buyer Last Name'
            data-env ='sandbox'/>
        <script src="https://sandbox.checkbook.io/static/api/v1/checkbook.js" class="checkbook-button" id="checkbook_api_js">
        </script>
    </form>
</code>

Please update data-redirect-url to your domain callback page.

b. Create a redirect page, e.g. callback.php

<?php
//get the form elements and store them in variables
$url = 'https://sandbox.checkbook.io/api/v1/charge';
$token=$_POST["token"]; 
$amount=$_POST["amount"] * 100;
$secret_key='your checkbook secret key'; 

$fields = array(
    'token' => $token,
    'amount' => $amount,
    'key' => $secret_key,
    );

//url-ify the data for the POST
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string, '&');

//open connection
$ch = curl_init();

//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);

//execute post
$result = curl_exec($ch);
$http_code = curl_getinfo($ch)["http_code"];
echo $http_code;

if( $http_code == 200){
    /* Direct users to the payment success page. */
    echo "<script>
            window.location.assign('https://www.example.com/success.html')
         </script>";
} else {
    /* Direct users to the payment failure page. */
    echo "<script>
            window.location.assign('https://www.example.com/failure.html')
         </script>";
}
//close connection
curl_close($ch);
?>