Monday, 26 August 2013
Tuesday, 20 August 2013
First Data Global Gateway API Plugin Component for CakePHP
The Ggapi component simplifies credit card processing using the First Data/Yourpay/Linkpoint Global Gateway API. It supports testing and live configurations, along with local to remote field mapping. Once configured, all you have to do is feed the component an array of order data (fields used are up to you) and it will map the fields, build the XML string, submit the string, read the response from the gateway, and convert the response back into an array.
Requirements: PHP5 with curl support and a Global Gateway API account (live or testing).
Download/git clone at http://github.com/chronon/ggapi.
The FirstData gateway needs a .pem file installed. This file can be downloaded from the downloads area of your FirstData account. test account of first data is http://www.firstdata.com/gg/apply_test_account.htm
If you access your website’s files (either using FTP or the host’s control panel file manager) drill down into the wp-content/plugins directory and drill down further into event-espresso.3.1.21.P/gateways/firstdata. There should be a few files in there. Upload the Pem file that you downloaded from First Data to that folder.
Make sure the file you upload has the same name as your store number. So if your store number is 12345678, the PEM file name should be 12345678.pem
Requirements: PHP5 with curl support and a Global Gateway API account (live or testing).
Example controller code:
<?php Ggapi->ggProcess($data, true); // update the order table with the response if ($response) { if ($response['r_approved'] == 'APPROVED') { // merge the response data with the order data $this->data['Order'] = array_merge($this->data['Order'],
$response);
} else {
// card was DECLINED
$error = explode(':', $response['r_error']);
$this->Session->setFlash(
'Your credit card was declined. The message was: '.
$error[1],'modal',
array('class' => 'modal error')
);
$this->redirect(array('controller' => 'orders',
'action' => 'checkout'));
}
} else {
// no response from the gateway
$this->Session->setFlash(
'There was a problem connecting to our payment gateway,
please try again.',
'modal',
array('class' => 'modal error')
);
$this->redirect(array('controller' => 'orders',
'action' => 'checkout')); } ?>
Download/git clone at http://github.com/chronon/ggapi.
The FirstData gateway needs a .pem file installed. This file can be downloaded from the downloads area of your FirstData account. test account of first data is http://www.firstdata.com/gg/apply_test_account.htm
If you access your website’s files (either using FTP or the host’s control panel file manager) drill down into the wp-content/plugins directory and drill down further into event-espresso.3.1.21.P/gateways/firstdata. There should be a few files in there. Upload the Pem file that you downloaded from First Data to that folder.
Make sure the file you upload has the same name as your store number. So if your store number is 12345678, the PEM file name should be 12345678.pem
Authorize.net Payment integration in PHP
These steps assume that your web server is on the public internet and can be accessed via a domain name or IP address.(localhost will not work)
Sign up for a Test Account.
Sign up for a test account to obtain an API Login ID and Transaction Key. These keys will authenticate requests to the payment gateway.
Download the Authorize.Net PHP SDK and include it in your project.
The Authorize.Net PHP SDK gives you access to the full suite of APIs.
Download the SDK
You'll need to include the file "anet_php_sdk/AuthorizeNet.php" in your project so make sure you save the SDK into a folder that your web server can access such as your var/www folder or your htdocs folder.
The PHP SDK contains a helper function that implements a demonstration
of the Direct Post Method in one line of code. Copy and paste the code
below into a new file named "direct_post.php" and fill in any incomplete
variables. Make sure your server is publicly accessible and that the
$url variable points to this new file.Download the SDK
You'll need to include the file "anet_php_sdk/AuthorizeNet.php" in your project so make sure you save the SDK into a folder that your web server can access such as your var/www folder or your htdocs folder.
Create a new PHP file that implements the Direct Post Method.
<?php require_once 'anet_php_sdk/AuthorizeNet.php'; // The SDK $url = "http://YOUR_DOMAIN.com/direct_post.php"; $api_login_id = 'YOUR_API_LOGIN_ID'; $transaction_key = 'YOUR_TRANSACTION_KEY'; $md5_setting = 'YOUR_API_LOGIN_ID'; // Your MD5 Setting $amount = "5.99"; AuthorizeNetDPM::directPostDemo($url, $api_login_id,
$transaction_key,
$amount, $md5_setting); ?>
Review and try it out!
Go to http://YOUR_DOMAIN.com/direct_post.php in your web browser and click the "Buy" button.
Verify payment transaction success onyour transaction report.
Verify payment transaction success onyour transaction report.
Monday, 19 August 2013
Opening PDF Files in Browser
Embedding a PDF using HTML markup
Click here to learn about embedding a PDF using JavaScriptEmbedding a PDF using the standards-compliant <object> element is actually rather simple, and looks like this:
<object data="myfile.pdf" type="application/pdf" width="100%"
height="100%">
<p>It appears you don't have a PDF plugin for this browser.
No biggie... you can <a href="myfile.pdf">click here to
download the PDF file.</a></p>
</object>
Note the <p> nested inside the <object>; this content will be displayed if the browser isn't capable of displaying the <object>.
In this example, the 'fallback' content contains a link to the PDF,
which allows visitors who don't have the Adobe Reader plugin to download
the PDF and view it offline.PDF Open Parameters
Adobe Reader provides a number of PDF open parameters that allow you to control how a PDF file is displayed when opened. Options include zoom level, jumping to a page number, highlighting search terms, and selecting which toolbars will be visible. Read more about PDF open parameters here.Not comfortable writing your own code?
Use the code generator. Simply fill out the form and the generator will provide you with standards-compliant markup you can copy and paste into your HTML file. The code generator can also automatically generate the PDF open parameter code for you. It's really convenient, and completely free! Click here to use the generator.
Subscribe to:
Comments (Atom)