sdk call works now, just the begining
This commit is contained in:
@@ -164,7 +164,9 @@ add_shortcode('custom_frontend_posting_form', 'custom_frontend_posting_form');
|
|||||||
function check_paypal_request()
|
function check_paypal_request()
|
||||||
{
|
{
|
||||||
error_log("----");
|
error_log("----");
|
||||||
if (is_page('test_paypal_ok'))
|
if (is_page('test_paypal_payment'))
|
||||||
|
error_log("on test_paypal_payment");
|
||||||
|
else if (is_page('test_paypal_ok'))
|
||||||
error_log("on test_paypal_ok");
|
error_log("on test_paypal_ok");
|
||||||
else if (is_page('test_paypal_infos'))
|
else if (is_page('test_paypal_infos'))
|
||||||
error_log("on test_paypal_infos");
|
error_log("on test_paypal_infos");
|
||||||
@@ -174,11 +176,17 @@ function check_paypal_request()
|
|||||||
error_log(json_encode($_GET));
|
error_log(json_encode($_GET));
|
||||||
error_log("_POST");
|
error_log("_POST");
|
||||||
error_log(json_encode($_POST));
|
error_log(json_encode($_POST));
|
||||||
|
// error_log("_COOKIE");
|
||||||
|
// error_log(json_encode($_COOKIE));
|
||||||
}
|
}
|
||||||
add_action('template_redirect', 'check_paypal_request');
|
add_action('template_redirect', 'check_paypal_request');
|
||||||
|
|
||||||
function paypal_shortcode_content()
|
function paypal_shortcode_content()
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
<input type="hidden" name="custom" value="5678" />
|
||||||
|
|
||||||
|
*/
|
||||||
$pp_live_client_id = "Aedn5e8z__hPBvKirqw5bwlhI9ChG8_N6c1xbgybYyBr4B4oP8uVzmVdH1QVKdPQKf6bWg7orPV4PDrO";
|
$pp_live_client_id = "Aedn5e8z__hPBvKirqw5bwlhI9ChG8_N6c1xbgybYyBr4B4oP8uVzmVdH1QVKdPQKf6bWg7orPV4PDrO";
|
||||||
$pp_sandbox_client_id = "AfcmwxIXlG2ZxaMdjazX57I70BXz__aEqNWaTnqfSCI34a0V7nMbytswx7EViUjlpHs7opyrRwaH9YLl";
|
$pp_sandbox_client_id = "AfcmwxIXlG2ZxaMdjazX57I70BXz__aEqNWaTnqfSCI34a0V7nMbytswx7EViUjlpHs7opyrRwaH9YLl";
|
||||||
$pp_client_id = $pp_live_client_id;
|
$pp_client_id = $pp_live_client_id;
|
||||||
@@ -186,19 +194,40 @@ function paypal_shortcode_content()
|
|||||||
|
|
||||||
$pp_sdk_currency = "EUR";
|
$pp_sdk_currency = "EUR";
|
||||||
$pp_sdk_debug = "true";
|
$pp_sdk_debug = "true";
|
||||||
$pp_sdk_base_url="https://www.paypal.com";
|
|
||||||
$pp_sdk_base_url="https://sandbox.paypal.com";
|
$pp_sdk_base_url="https://sandbox.paypal.com";
|
||||||
|
$pp_sdk_base_url="https://www.paypal.com";
|
||||||
$pp_sdk_client_token="abc123xyz==";
|
$pp_sdk_client_token="abc123xyz==";
|
||||||
$pp_sdk_src="$pp_sdk_base_url/sdk/js?client-id=$pp_client_id¤cy=$pp_sdk_currency&debug=$pp_sdk_debug";
|
$pp_sdk_src="$pp_sdk_base_url/sdk/js?client-id=$pp_client_id¤cy=$pp_sdk_currency&debug=$pp_sdk_debug";
|
||||||
|
$pp_sdk_src="$pp_sdk_base_url/sdk/js?client-id=$pp_client_id";
|
||||||
$pp_sdk_attributes="src='$pp_sdk_src' data-client-token='$pp_sdk_client_token'";
|
$pp_sdk_attributes="src='$pp_sdk_src' data-client-token='$pp_sdk_client_token'";
|
||||||
|
$pp_sdk_attributes="src='$pp_sdk_src'";
|
||||||
|
$pp_sdk_html_script="<script $pp_sdk_attributes></script>";
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
?>
|
?>
|
||||||
<script <?php echo $pp_sdk_attributes ?> ></script>
|
<h1>old button :</h1>
|
||||||
|
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
|
||||||
|
<input type="hidden" name="cmd" value="_s-xclick" />
|
||||||
|
<input type="hidden" name="hosted_button_id" value="H876N9DGSCLKS" />
|
||||||
|
<input type="hidden" name="currency_code" value="EUR" />
|
||||||
|
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" title="PayPal - The safer, easier way to pay online!" alt="Buy Now" />
|
||||||
|
</form>
|
||||||
|
<h1>new button :</h1>
|
||||||
|
<script>console.log(<?php echo json_encode($pp_sdk_attributes, JSON_HEX_TAG) ?>);</script>
|
||||||
|
<?php echo $pp_sdk_html_script; ?>
|
||||||
<div id="paypal-button-container"></div>
|
<div id="paypal-button-container"></div>
|
||||||
<p id="result-message"></p>
|
<p id="result-message"></p>
|
||||||
<script>
|
<script>
|
||||||
paypal.Buttons({
|
console.log("paypal:");
|
||||||
|
console.log(paypal);
|
||||||
|
|
||||||
|
paypal.Buttons({
|
||||||
|
style: {
|
||||||
|
layout: 'vertical',
|
||||||
|
color: 'blue',
|
||||||
|
shape: 'rect',
|
||||||
|
label: 'paypal',
|
||||||
|
},
|
||||||
// Order is created on the server and the order id is returned
|
// Order is created on the server and the order id is returned
|
||||||
createOrder() {
|
createOrder() {
|
||||||
return fetch("/my-server/create-paypal-order", {
|
return fetch("/my-server/create-paypal-order", {
|
||||||
@@ -221,10 +250,10 @@ function paypal_shortcode_content()
|
|||||||
.then((order) => order.id);
|
.then((order) => order.id);
|
||||||
}
|
}
|
||||||
}).render('#paypal-button-container');
|
}).render('#paypal-button-container');
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
return ob_get_clean();
|
return ob_get_clean();
|
||||||
|
|
||||||
}
|
}
|
||||||
add_shortcode('fipf_paypal_shortcode', 'paypal_shortcode_content');
|
add_shortcode('fipf_paypal_shortcode', 'paypal_shortcode_content');
|
||||||
|
|
||||||
|
|||||||
2
private
2
private
Submodule private updated: 926bb3b415...31a5126c32
Reference in New Issue
Block a user