/** create a basket, put the article in and return the spreadshirt checkout url */
 public function checkout($article, $shopId, $size, $appearance)
 {
     // create a new basketitem
     $payload = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><basketItem  xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://api.spreadshirt.net">';
     // if no shopId is set, use the marketplace checkout
     if (isset($shopId)) {
         $payload .= '<shop id="' . $shopId . '" xlink:href="http://api.spreadshirt.net/api/v1/shops/' . $shopId . '"/>';
     }
     // prepare the upload, which is a xml document
     // some elements are not necessary/ignored (see price element)
     $payload .= '<description>bla</description>' . '<quantity>1</quantity>' . '<element id="' . $article->getArticleID() . '" type="sprd:article" xlink:href="' . $article->getArticleUrl() . '">' . '<properties>' . '<property key="appearance">' . $appearance . '</property>' . '<property key="size">' . $size . '</property>' . '</properties>' . '</element>' . '<price><vatIncluded>34.40</vatIncluded><currency id="1"/></price>' . '</basketItem>';
     $customBasket = $this->createBasket($shopId);
     // the basket url has some extra parameters, for security reasons
     // we never send our secret over the network. We send only a evidence
     // which is called signature
     $url = $customBasket . "/items";
     $stamp = time() * 1000;
     $signature = $this->getSignature('POST', $url, $stamp);
     // construct the basket url and add the required parameter
     $url = $url . "?apiKey=" . $this->API_KEY . "&sig=" . $signature . '&time=' . $stamp;
     // call api, put item into the current basket
     $this->performPostRequest($url, $payload);
     //basket api url - debug
     //        $url=$customBasket;
     //        $signature=$this->getSignature('GET', $url, $stamp);
     //        $url=$url."?apiKey=".$this->API_KEY."&sig=".$signature.'&time='.$stamp;
     //        echo "basket url is :".$url."<br>";
     // request the checkout url for redirect
     $url = $customBasket . "/checkout";
     $signature = $this->getSignature('GET', $url, $stamp);
     $url = $url . "?apiKey=" . $this->API_KEY . "&sig=" . $signature . '&time=' . $stamp;
     $rest = new RestRequest();
     $xml = simplexml_load_string($rest->doGetCall($url));
     return (string) $xml->attributes('http://www.w3.org/1999/xlink');
 }