Exemple #1
0
            } catch (Exception $e2) {
                /* falls back to $e message bellow */
            }
        }
        if ($e->getCode() == 400) {
            header("Location: " . $client->getLoginURI(array('redirect_uri' => $client->getCurrentURI(array(), array('logout', 'error', 'code', 'order_id', 'spid_page')))));
            exit;
        }
        // API exception, show message, remove session as it is probably not usable
        unset($_SESSION['sdk']);
        echo '<h3 id="error" style="color:red">' . $e->getCode() . ' : ' . $e->getMessage() . '</h3>';
    }
    echo '<p><a id="login-link" href="' . $client->getAccountURI(array('redirect_uri' => $client->getCurrentURI(array(), array('logout', 'error', 'code', 'order_id', 'spid_page')))) . '">My Account</a></p>';
    // Show a logout link
    echo '<p><a id="login-link" href="' . $client->getLogoutURI(array('redirect_uri' => $client->getCurrentURI(array('logout' => 1), array('error', 'code', 'order_id', 'spid_page')))) . '">Logout</a></p>';
    echo '<p><a id="login-link" href="' . $client->getPurchaseURI(array('redirect_uri' => $client->getCurrentURI(array(), array('logout', 'error', 'code', 'order_id', 'spid_page')), 'cancel_redirect_uri' => $client->getCurrentURI(array('cancel' => 1), array('logout', 'error', 'code', 'order_id', 'spid_page')))) . '">Buy something</a> (standard checkout flow)</p>';
    echo '<p><a id="login-link" href="' . $client->getPurchaseURI(array('campaign_id' => 1, 'redirect_uri' => $client->getCurrentURI(array('cameback' => 2), array('logout', 'error', 'code', 'order_id', 'spid_page')), 'cancel_redirect_uri' => $client->getCurrentURI(array('cancel' => 1), array('logout', 'error', 'code', 'order_id', 'spid_page')))) . '">Campaign Flow</a> (checkout flow with campaign specified</p>';
} else {
    // No session, user must log in
    echo '<h3 id="message">Please log in</h3>';
    // Show a login link
    echo '<p><a id="login-link" href="' . $client->getLoginURI(array('redirect_uri' => $client->getCurrentURI(array('place' => 'oslo'), array('logout', 'error', 'code', 'default', 'cancel', 'order_id', 'spid_page')), 'cancel_redirect_uri' => $client->getCurrentURI(array('cancel' => 1), array('logout', 'error', 'code', 'default', 'cancel', 'order_id', 'spid_page')))) . '">Login</a> (standard auth flow)</p>';
    echo '<h5>or</h5>';
    echo '<p><a id="signup-flow-link" href="' . $client->getSignupURI(array('redirect_uri' => $client->getCurrentURI(array(), array('logout', 'error', 'code', 'order_id', 'spid_page')), 'cancel_redirect_uri' => "http://google.com")) . '">Signup Flow</a> (standard auth flow with signup parameter</p>';
    echo '<h5>or</h5>';
    echo '<p><a id="checkout-link" href="' . $client->getPurchaseURI(array('redirect_uri' => $client->getCurrentURI(array(), array('logout', 'error', 'code', 'order_id', 'spid_page')), 'cancel_uri' => $client->getCurrentURI(array('cancel' => 1), array('logout', 'error', 'code', 'default', 'cancel', 'order_id', 'spid_page')))) . '">Buy</a> (standard checkout flow)</p>';
}
?>
</body>
</html>
Exemple #2
0
        <p></p>
    </div>
	<div class="field">
		<label for="">asasdas</label>
		<input type="text" name="">
	</div>
	<div class="field footer">		
		<input class="" type="submit" value="Submit">		
	</div>			
</form>
	<div id="exampleUrlContainer">

		<h1 id="exampleUrlLink">Show Example URL's</h1>
		<ul id="exampleUrls">
			<li><a href="<?php 
    echo $client->getPurchaseURI(array('redirect_uri' => $client->getCurrentURI(array(), array('logout'))));
    ?>
">Purchase Any Product</a></li>
			<li><a href="<?php 
    echo $client->getPurchaseURI(array('product_id' => '1', 'redirect_uri' => $client->getCurrentURI(array(), array('logout'))));
    ?>
">Purchase Product 1</a></li>
			<li><a href="<?php 
    echo $client->getPurchaseURI(array('product_id' => '1', 'display' => 'popup', 'redirect_uri' => $client->getCurrentURI(array(), array('logout'))));
    ?>
&keepThis=true&TB_iframe=true&height=380&width=300" class="thickbox">1 Click Purchase</a></li>
			<li><a href="<?php 
    echo $client->getAccountURI();
    ?>
">Account page</a></li>
			<li><a href="<?php