Nov 25, 2013

CURL: Post request with payload/content body

Curl Command with a JSON Data
curl --header "Content-Type: application/json" -X POST -d '{"state": "----X----"}' http://localhost:8888/_ah/api/tictactoe/v1/board

Curl Command with POST Parameter
curl  -X POST -d 'key1=value1&key2=value2&' http://localhost:8888/_ah/api/tictactoe/v1/board

Curl Command with GET Parameter
curl  -X GET -d 'key1=value1&key2=value2&' http://localhost:8888/_ah/api/tictactoe/v1/board

This sample command get from tictactoe

Nov 19, 2013

Magento: How to override the home url.

The Goal here is, instead of modifying the CMS(in admin) for the home data. You can better create a custom module to handle this one. At this place you have control to the controller, block and template. Unlike when you use the CMS to update you home, you can only controller the block and template with the sample tag below
{{ block="module/block" template="module/block.phtml"}}
BTW, to do the use the custom module as your home goto System -> Configuration -> Web -> Default Pages -> Default Web URL

But if you want to, just to change the home page, you can try this System -> Configuration -> Web -> Default Pages
Change the value of

Default Web URL " cms
CMS Home Page :  Choose the available pages in the drop down

Oct 29, 2013

How to calculate the needed PSI for your bike tire?

I found this one from a bike forum, and I just want to share too.

Tire Width=20: Pressure(psi) = (0.33 * Rider Weight in lbs) + 63.33
Tire Width=23: Pressure(psi) = (0.33 * Rider Weight in lbs) + 53.33
Tire Width=25: Pressure(psi) = (0.33 * Rider Weight in lbs) + 43.33
Tire Width=28: Pressure(psi) = (0.33 * Rider Weight in lbs) + 33.33
Tire Width=32: Pressure(psi) = (0.17 * Rider Weight in lbs) + 41.67
Tire Width=37: Pressure(psi) = (0.17 * Rider Weight in lbs) + 26.67

Example: You are 150lbs running 28's
Pressure (psi) = (0.33*150) +33.33 = 82.83psi (rear)
Front Pressure = .9*Rear Pressure = .9*82.83psi = 74.55psi front

Courtesy to Kyle V. from

Oct 24, 2013

Magento: How to remove the SID parameter in you store URL?

There two this we can do here.

1. Modify the setting in your magento admin.
* Go to System > Configuration > Web > Session Validation Settings and set the value of Use SID on Frontend into No
2. Sometimes the setting from your admin was cache and hard to flush your magento cache coz of many reason. Slowing the page.
To do this, modify the your core magento class app/code/core/Mage/Core/Model/App.php and set the value of $_useSessionInUrl into false. Since the default is true.
protected $_useSessionInUrl = true;

Apache: How to log the Original IP or X-Forwarded-For in you access log

You need to modify you apache configuration and find the related data below and update according to data below.

LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b " combined
CustomLog /var/log/httpd/access_log combined

Oct 11, 2013

CSS(a/img) - Remove extra space on anchor with image tag

Just want to share the work around.

Normally around will goes like this.
<a href="#"><img  src="/image.jpg" /></a>

Update code to remove the extra space. Just add the display:block in the image tag.
<a href="#"><img style="display:block" src="/image.jpg" /></a>

Oct 4, 2013

How to build you wheelset with 36 holes hub and 32 holes rim.

Im not sure what the best way to express how it must done but pattern already good enough for us to reach our goal here. By the best one person who share it here is his pattern.

For other stuff/logic he made and other pattern on mismatch number of holes. Please follow his page Mismatched Wheelbuilding

Apache: configure apache .htaccess to filter incomming request behind proxy

Normally we write we configure apache rewrite rule with underscore on every word separator. See below.

RewriteCond %{REMOTE_ADDR}
RewriteCond %{REQUEST_URI} phpinfo.php

For custom server variable made separated by dash(-) on every word and has a prefix of HTTP:. This mean to set X-FORWARDED-FOR see below.

Sep 30, 2013

TipsAndTrick: What maid my apache stop?

This error came-up after I installed the subversion on my machine.

Mon Sep 30 16:07:08 2013] [notice] SIGHUP received.  Attempting to restart
httpd: Syntax error on line 223 of /etc/httpd/conf/httpd.conf: Syntax error on line 6 of /etc/httpd/conf.d/php.conf: Cannot load /etc/httpd/modules/ into server: /usr/lib64/ symbol gzopen64, version ZLIB_1.2.3.3 not defined in file with link time reference

I cant imaging that apache dependencies has also relation to subversion dependency package. But this is really happen.
As verify my latest Installed and update, zlib was one of them.
$ sudo tail -n 20 /var/log/yum.log
Sep 30 05:13:46 Updated: zlib-1.2.5-7.11.amzn1.x86_64
Sep 30 05:13:46 Updated: apr-1.4.6-1.10.amzn1.x86_64
Sep 30 05:13:46 Installed: libtasn1-2.3-3.4.amzn1.x86_64
Sep 30 05:13:47 Installed: gnutls-2.8.5-10.10.amzn1.x86_64
Sep 30 05:13:47 Installed: neon-0.29.5-1.10.amzn1.x86_64
Sep 30 05:13:47 Installed: subversion-libs-1.7.13-1.32.amzn1.x86_64
Sep 30 05:13:48 Installed: subversion-1.7.13-1.32.amzn1.x86_64
Sep 30 05:13:48 Updated: libxml2-2.7.8-10.26.amzn1.x86_64
Sep 30 05:13:48 Updated: zlib-1.2.5-7.11.amzn1.i686

By rebooting my system apache works and run again like miracle. This case I learn something, that in every update made in your system, find a time to reboot. :)

Happy rebooting

Sep 17, 2013

SSH - How to configure ssh-agent.

This is the simple script to activate the ssh-agent

If you are using bash, copy the code below and paste at the end of ~/.profile or ~/.bash_profile file. The user profile file defends on the linux distro you use. But as I notice Debian(OpenSuse, Ubunto) use ~/.profile and RHEL(Fedora, CentOS) use ~/.bash_profile. By the way the code below are need to put the end of you user profile.

function start_agent {
     echo "Initialising new SSH agent..."
     /usr/bin/ssh-agent | sed 's/^echo/#echo/' > ${SSH_ENV}
     echo succeeded
     chmod 600 ${SSH_ENV}
     . ${SSH_ENV} > /dev/null

# Source SSH settings, if applicable

if [ -f "${SSH_ENV}" ]; then
     . ${SSH_ENV} > /dev/null
     #ps ${SSH_AGENT_PID} doesn’t work under cywgin
     ps -ef | grep ${SSH_AGENT_PID} | grep ssh- agent$ > /dev/null || {
If you are using tcsh, copy the code below and paste at the end of ~/.login file.
set SSH_AGENT=/usr/bin/ssh-agent
set TMP_FILE=~/.ssh/ssh-agent-info

#  Check for existing ssh-agent process
if ( -s $TMP_FILE ) source $TMP_FILE
if ( $?SSH_AGENT_PID ) then
  set this=`ps -elf | grep ${SSH_AGENT_PID} | grep ssh-agent > /dev/null`
  # start ssh-agent if status is nonzero
  if (( $? != 0 ) && ( -x "$SSH_AGENT" )) then
    source $TMP_FILE
    echo "ssh agent started [${SSH_AGENT_PID}]"

Sep 5, 2013

Magento: How to enable Profiler in magento?

First thing you my uncomment below code in your index.php

Enable the store profiler in your magento admin. See the configuration in.
System -> Configuration -> Developer -> Debug -> Profiler

NOTE: if you are working on costumed magento theme be sure the profiler block added in you page.xml
<default translate="label" module="page">
// Some other stup here.
<block type="core/profiler" output="toHtml" name="core_profiler" />

If you want to profile your own module you can declare do below code.
// ... Some batch of code here.

Sep 3, 2013

Magento: How to select a collection with one field only.

Here's what one user did. I it work like a charm to me.
    ->reset(Zend_Db_Select::COLUMNS) // THis is import thing
    ->columns('MAX(created) as max_created')

As courtesy to eth original post Magento: Single field collection

Aug 29, 2013

GAE - Datastore filtering using IN operator

Since I can't find in datastore queries the documentation on how to use the IN operator, that why I decide to share my expirimentaion.

Here how I did.
Query q = new Query("YourKindHere");
// Create a list of possible data tobe compare in your IN operator
List<Long> levels =  new ArrayList<Long>(); // Initiate a List object
// Add the possible levels
// INFO: If you notice, I put "l" to represent the value as Long
arrayList.add(1l); // add level 1
arrayList.add(2l); // add level 2
arrayList.add(3l); // add level 3

// Create and AND operation with IN operators
  FilterOperator.EQUAL.of("active", 1l), // compare as active=1
  FilterOperator.IN.of("level", levels) // compare ad level IN (1, 2, 3)

For other info about queries please check google appengine datastore query docs. Java DataStore Queries.

Aug 12, 2013

Android: How to install the apps to you SD Card as default.

Here basic requirement.
Android SDK

Assume you already installed the java and extract the Android sdk.
In your DOS Command prompt/Console.
1 Change working directory
cd Android-SDK/platform-tools
2 List the devices connected
adb devices

3 Change the default location.
adb shell pm setInstallationLocation 2

INFO: If you want to revert the past setting just change the 2 to 0

Aug 6, 2013

Magento: How to reindex via ssh or in terminal/console

Since reindexing request long term of running in our webserver. I thing it is better to do this one the console, to liminated the posoble timeout error.

Below are some possible command you can use.
Index product attributes for layered navigation building
php shell/indexer.php -reindex catalog_product_attribute

Rebuild Catalog product fulltext search index
php shell/indexer.php -reindex catalogsearch_fulltext

Reorganize EAV product structure to flat structure
php shell/indexer.php -reindex catalog_category_flat

Index Product Stock Status
php shell/indexer.php -reindex cataloginventory_stock

Indexed category/products association
php shell/indexer.php -reindex catalog_category_product

Index product prices
php shell/indexer.php -reindex catalog_product_price

Rebuild Tag aggregation data
php shell/indexer.php -reindex tag_summary

Index product and categories URL rewrites
php shell/indexer.php -reindex catalog_url

If you want to reindex all.
php shell/indexer.php -reindexall

Also, for other useful command parameter you can use help screen that is accessable via SSH using the command:
php ./shell/indexer.php -help

SVN - How to recommit failed commit with svn-commit.tmp

To deal with this, and since we get failed commit the file is created. In some reason this file created so we don't lost the big long comment for our commit.

To reuse the commit info

svn ci -F svn-commit.tmp

INFO: The file also free to delete. just rm it.

Jul 29, 2013

CSS - Understanding the unit for font size.

Normally the equivalent of the unit is listed below.
1em = 12pt = 16px = 100%.

However that the unit have same conversion value. There still a different behavior on the display of the content.

As explained in, using a percent(%) much more reliable to use. And he was also recommend to use % as unit to use in website designning. See more explanation in his topic here

Jul 18, 2013

HTML: Special keywords for mobile site(SMS composer and Voice Call)

here some special keyword on phone. This is like mailto on your pc.

Compose an SMS to you mobile website

sms:12345678?body=Your default message
In some other devices some URI are also working. mms:, smsto: or mmsto:.

To call the mobile.


This was also use in mobile facebook..

Jul 17, 2013

Magento: Creating block and inject to you layout.

Here the simple code

// In your controller action
public function indexAction()
  //Get current layout state
  $block = $this->getLayout()->createBlock(
    array('template' => 'module/my_custumtemplate.phtml') 

  // always to for surely the you block not invalid
  }catch(Exception $e){
  //Release layout stream... lol... sounds fancy

Jul 11, 2013

How to download movie in

For this tutorial, I will going use FHM 2013 stream.
FHM Stream or FHM Stream on

* You must have account to and must login.(I not sure if make with login coz I was login on the time I made this)


1. Visit FHM Stream on and check the html source code(Please use Inspect Element tool of you chrome browser). Point your mouse pointer on the nearest part of the Flash Stream for you to easy to find the code and Right Click your mouse then select Inspect Element(if you cant see option point in other place, maybe you are pointing to none html element, maybe image/Flash)

You must see this code this view, and you need to concatenate the value of data attribute in object element and value of params element with name flashvars

Base on the given information.
Object element of data attribute value
The value of params with the name of flashvars is

To concatenate you must put ampersand(&) in between the given data.

2. Visit the URL and copy the Status URL, see screen shot below

From the highlighhted data on the image, this is the URL which is what we need to download the content. Download FHM 100 Sexiest Woman 2013

Maybe the URL given is not working since I login by my account. So better check the by ur self.

UPDATE: The Exact url can be extract as.

Jul 3, 2013

Magento: How to minified your html content?

I know its very bad idea to modify the core code, but sorry I don't have time to test override the class.

To do this you need to modify Mage_Core_Block_Template class and its fetchView method.

public function fetchView($fileName)
  // ***********
  // Some other code up
  // *********************

  // This is the in the bottom code
  if (Mage::app()->getStore()->getCode() == 'admin'){
     // Admin must not to minify since, there was lot on inline comment(//)
     // which generate javascript error.
     return $html;
    // Instead of just returning the html data, you need to
    //  remove the  un-needed extra space and new lines.
    $html = preg_replace('/\s+/', ' ', trim($html)); // remove new line

    // Remove space on every start on a tag </script> <div> become </script> <div>
    $html = preg_replace('/ </', '<',$html); // For more compression only you can skip this line.

    return $html; 



This is not applicable if you have javascript in your template will an inline comment double slash(//). Since the code become one line, whole javascript after the // become comment. I know you know that. Suggestion pleas use the group comment(/*** Your comment inside */) or move all you javascript in a js file. :)


Jul 2, 2013

Magento: core_file_storage' doesn't exist'

This kind of error mostly happen if you just copy a database and checkout the source that you team is working for..

So here the solution I found, create to tables manually.
CREATE TABLE `core_directory_storage` (
  `name` VARCHAR(255) NOT NULL DEFAULT '',
  `path` VARCHAR(255) NOT NULL DEFAULT '',
  PRIMARY KEY (`directory_id`),
  INDEX `parent_id` (`parent_id`),
  REFERENCES `core_directory_storage` (`directory_id`) ON UPDATE     CASCADE ON DELETE CASCADE
COMMENT='Directory storage'
CREATE TABLE `core_file_storage` (
  `content` LONGBLOB NOT NULL,
  `filename` VARCHAR(255) NOT NULL DEFAULT '',
  `directory_id` INT(10) UNSIGNED NULL DEFAULT NULL,
  `directory` VARCHAR(255) NULL DEFAULT NULL,
  PRIMARY KEY (`file_id`),
  UNIQUE INDEX `IDX_FILENAME` (`filename`, `directory`),
  INDEX `directory_id` (`directory_id`),
    REFERENCES `core_directory_storage` (`directory_id`) ON UPDATE CASCADE ON DELETE CASCADE
COMMENT='File storage'

Jun 20, 2013

Java: How to get cookie from HttpURLConnection

Here the simple code to get the site response cookie.

URL urlReq = new URL("");

conn = (HttpURLConnection) urlReq.openConnection();

// Start building other http request parameter
conn.setRequestProperty("User-Agent", "Mozilla/5.0 (X11; Linux i686; rv:21.0) Gecko/20100101 Firefox/21.0");
conn.setRequestProperty("Accept-Encoding", "gzip, deflate");
conn.setRequestProperty("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7");
conn.setRequestProperty("Connection", "close");


resCode = conn.getResponseCode(); 
if (resCode==HttpURLConnection.HTTP_OK){
 for(Map.Entry<String, List<String>> headers : conn.getHeaderFields().entrySet()){
 if (headers.getKey().equals("set-cookie")){"\t==>"+headers.getKey());
      for(String hval : headers.getValue()){"\t\t==>"+hval);
 }else{"\t==>"+headers.getKey() +" = "+conn.getHeaderField(headers.getKey()));

You can also use
However, the bad thing is you can one get one cookie, I suggest to use

Happy Reading

Jun 5, 2013

How to determine the user browser version in html?

Since this code, is only application in IE(Internet Explorer). Maybe the question is, How to determine the browser version in html.

This this check is the user user IE Browser, whatever the version.
<!--[if IE]>
Place content here to target all Internet Explorer users.

This was opposite behavior on the first item. "This is only run when the browser is NOT Internet Explorer".
<![if !IE]>
Place content here to target all users not using Internet Explorer.

This will run if the browser version is greater than or equal to 8.
<!--[if gte IE 8]>
Place content here to target users of Internet Explorer 8 or higher.

A similar example above that only runs when the browser version is less than 7 (i.e. 6 or lower).
<!--[if lt IE 7]>
Place content here to target users of Internet Explorer 6 or lower (less than 7).

The code/conditions are only run when running on IE browser, otherwise the browser will detect/treat as normal comment.

May 15, 2013

How to charge iPad/iPhone on linux(OpenSuse)

Im not sure if this already in the package repository OpenSuse. Since Spec file already already found opensuse. As I say Im NOT SURE, But I want you to try if you are use the latest/later version of OpenSuse. Currently Im using OpenSuse 11.2.

Try to go in your YAST package and search "ipad_charge". If exists, your lucky. :) But If not. Try to compile it. Please follow instruction below.

Initial requirement:
1 libusb-1.x.x and libusb-1.x.x-dev
2. gcc

1. Download the ipad_charge source to Rainbow Software or ipad_charge.

2. Remember to Install libusb-1.x.x and libusb-1.x.x-dev.
3. Extract the downloaded source code of ipad_charge.
syntax3rror@syntax3rror:~/Utils> tar -xzf ~/Installer/ipad_charge_1.1.tar.gz
4. Change the directory where you extractthe source. For me I extract Utils.
syntax3rror@syntax3rror:~/Utils> cd ipad_charge-1.1/
5 Compile and install the source code.
sudo make install
That's it, your DONE.

Possible error encounter.
syntax3rror@syntax3rror:~/Utils/ipad_charge-1.1> make
gcc -Wall -Wextra ipad_charge.c -lusb-1.0 -o ipad_charge
ipad_charge.c:7:31: fatal error: libusb-1.0/libusb.h: No such file or directory
compilation terminated.
make: *** [ipad_charge] Error 1
This error encounter when you forgot to install libusb-1.x.x and libusb-1.x.x-dev.

May 2, 2013

magento: How to get the current login customer?

Get the customer session
$customer = Mage::getSingleton('customer/session')->getCustomer();

Get customer properties.
$customer->getName(); // Full name
$customer->getFirstName(); // First name
$customer->getLastName(); // Last name

You can also get other customer custom attribute, like nick_name

If you think you need to know the current admin user try this one.

Apr 25, 2013

GAE - PreparedQuery.TooManyResultsException

Just take note before using asSingleEntity you must to make sure that you query will on return one entity(record) or else you will came up a problem TooManyResultsException

Suggestion to limit this unexpected behavior

public static Entity getSingleData(Query q){
  FetchOptions fOption = FetchOptions.Builder.withLimit(1);
   return datastore.prepare(q).asList(fOption).get(0);
  }catch (IndexOutOfBoundsException e) {
   logger.warning("No data sorry: "+e.getMessage());
   return null;
  //return datastore.prepare(q).asSingleEntity();

Feb 28, 2013

Happy Birthday Tabs

Playing this one can be in different tab.
Tab 1



Tab 2

Tab 3
Power Chord Version, Rock Styled

Feb 14, 2013

Zend: Authenticating into server

Since, setAuth still not working. I rather manually set the parameter to the cURl.

$config = array(
    'maxredirects' => 3, // By defualt Zend_Http_Client use 5 max redirect
    'timeout'   => 500,
    //'adapter'   => 'Zend_Http_Client_Adapter_Curl',


$client = new  Zend_Http_Client($url, $config);
//$client->setAuth($this->_user, $this->_pass); // Since seems not working I use
    'skuId' => $skuId,
    'username' => $this->_user,
    'password' => $this->_pass,

        ->setCurlOption(CURLOPT_USERPWD, $this->_user.':'.$this->_pass)
       ->setCurlOption(CURLOPT_SSL_VERIFYPEER, false)
       ->setCurlOption(CURLOPT_RETURNTRANSFER, 1)
       ->setCurlOption(CURLOPT_POST, 1)
$this->_response = $client->request("POST");

Jan 29, 2013

How to configure fastcgi(mod_fcgid) for apache.

Install mod_fcgid if not yet install.
yum install mod_fcgid

Edit http.conf, but be sure to backup before do any changes.
DocumentRoot "/var/www/html"

# FcgidMaxRequestsPerProcess should be <= PHP_FCGI_MAX_REQUESTS
# The example PHP wrapper script overrides the default PHP setting.
FcgidMaxRequestsPerProcess 10000

# Uncomment the following line if cgi.fix_pathinfo is set to 1 in
# php.ini:
# FcgidFixPathinfo 1


<Document "/var/www/html">
AddHandler fcgid-script .php
Options +ExecCGI
FcgidWrapper /usr/bin/php-wrapper .php



As you notice I did not use an Alias to specific directory. Since, I decide to use fast-cgi rather than mod_php, I modify Document either.

Create the wrapper file /user/bin/php-cgi-wrapper
# Set desired PHP_FCGI_* environment variables.
# Example:
# PHP FastCGI processes exit after 500 requests by default.

# Replace with the path to your FastCGI-enabled PHP executable
exec /usr/bin/php-cgi

Change the wrapper permission to executable.
chmod 755 /user/bin/php-cgi-wrapper

Jan 28, 2013

GAE - How to to handle DeadlineExceededException

Before we do. Lets recap how this Exception encounter or what is the cause?

This Exception encounter when a request runtime exceed the 60 sec runtime. Some you are working with loop.

Lets take some example. Somehow you are looping some data and update some properties of every record.

Possible solutions/workaround

Somehow you must have extract servlet the equivalent process to every record. Lets take you have servlet /updateData and /updateDataBackend. You updateDataBackend will process the other data that will possible reach by Deadline. By the use getRemainingMillis() method you can able determine if the extra will be reach by Deadline.




for(Entity ent : myDataEntities){
  if (ApiProxy.getCurrentEnvironment().getRemainingMillis() > 5000){
     // I think 5 seconds can still do the job
  // Update data
    // Opps, It almost reach DeadlineExceededException better create a backend procress
    // for extra data
    //  Please the updateDataBackend to run in backend

Hope that helps. Also try to read The_Request_Timer

Happy reading

Jan 18, 2013

Getting Stated on Spring MVC with Google AppEngine

Since, Appengine was the best free java server to deploy application. This is why good to integrate java frameworks to google appengine.

As this point, assume that you already create your Google Appengine project. However if you don't know how to create GAE project go here.

* Eclipse Kepler + Spring 3.2.4 + Google App Engine 1.9.7 + Java 7
* Download Spring jars
Extract the zip files and copy jars to war/WEB-INF/lib/(for deployment) and include the jars in project library.

1. Create mv-dispacher-servlet.xml.
<beans xmlns=""
 xsi:schemaLocation="    ">
 <context:component-scan base-package="com.winzter.springmvc.controllers">
  <context:exclude-filter type="regex" expression="com.winzter.springmvc.controllers.GuessController.*" />
 <!-- DEFINE Your bean Here -->
  <bean class="com.winzter.springmvc.controllers.GuessController" />
  <bean  class="" />
   <bean class="com.winzter.airgames.bigbarnword.controllers.FriendsController" />
 <mvc:annotation-driven />
 <!-- Bean to show you Di in GAE, via Spring, also init the MovieController -->
 <bean class="com.winzter.springmvc.controllers.GuessController">
  <property name="message">
   <value>Hello World</value>
  <!--constructor-arg name="message" value="Help ET go home" /-->
 <!-- bean class="com.winzter.airgames.bigbarnword.controllers.FriendsController">
  <property name="message">
   <value>Hello World</value>
 <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
  This serve for JSPs
  Every controller menthod return string, it file /pages/string.jsp 
  <property name="prefix">
  <property name="suffix">


2. Update/add code below to web.xml




Jan 7, 2013

How to create Authorize Express Checkout in paypal

Here what I got.

1. Setup the Authorization

Endpoint URL:
HTTP method: POST
POST data:

"&USER="+ Constant.PAYPAL_USER
+ "&PWD=" + Constant.PAYPAL_PASSWORD
+ "&VERSION=95"
+ "&PAYMENTREQUEST_0_AMT=10.00" //
+ "&L_PAYMENTREQUEST_0_NAME0=Bigbarn World Robot" // this will see inline w/ the price
+ "&L_PAYMENTREQUEST_0_DESC0=30 Days"+  // Item Description
+ "&L_PAYMENTREQUEST_0_NUMBER0=9999" // Item number:
+ "&CALLBACKTIMEOUT=6" // Default was 3 seconds

2. Redirect to Customer Paypal Payment

Token will found on the response from SetExpressCheckout Authorization request


3. Confirm the Authorization

This must be run after the confirmation of the buyer and return the to merchant site with two parameter. This URL was specify in RETURNURL SetExpressCheckout

Endpoint URL:
HTTP method: POST
POST data:
"&USER="+ Constant.PAYPAL_USER
+ "&PWD=" + Constant.PAYPAL_PASSWORD
+ "&VERSION=95"
+ "&METHOD=DoExpressCheckoutPayment"
+ "&TOKEN=EC-40319508UX6051234"+
+ "&PAYERID=7HUG6564UM62C" // this was get http request parameter
ACK => Success
TOKEN => EC%2d40319508UX6051234

Finally the Authorization if DONE

4. Confirm the Authorization

You can capture the payment via PAYPAL CMS or API.

Endpoint URL:
HTTP method: POST
POST data:
"&USER="+ Constant.PAYPAL_USER
+ "&PWD=" + Constant.PAYPAL_PASSWORD
+ "&VERSION=95"
+ "&METHOD=DoCapture"
+ "&AUTHORIZATIONID=0289443010274664U"  // This will be the PAYMENTINFO_0_TRANSACTIONID in DoExpressCheckoutPayment
+ "&AMT=10.00"
+ "&COMPLETETYPE=Complete";

ACK => Success
TOKEN => EC%2d40319508UX6051234

For other here my reference:
How create and process order using express checkout