8 $_REQUEST[
'__ecommerce__'][
'__carrello__'][
'__articoli__'][
'00000001'][
'quantita'] = 1;
9 $_REQUEST[
'__ecommerce__'][
'__carrello__'][
'__articoli__'][
'00000001'][
'id_iva'] = 1;
10 $_REQUEST[
'__ecommerce__'][
'__carrello__'][
'__articoli__'][
'00000001'][
'id_modalita_spedizione'] = 1;
14 require
'../../../../_src/_config.php';
16 #1 use PayPalCheckoutSdk\Core\PayPalHttpClient; 17 #1 use PayPalCheckoutSdk\Core\SandboxEnvironment; 19 ini_set(
'error_reporting', E_ALL);
20 ini_set(
'display_errors',
'1');
21 ini_set(
'display_startup_errors',
'1');
23 # $h = fopen( 'order.log', 'w+' ); 24 # fwrite( $h, '=== INIZIO LOG ORDINE ===' . PHP_EOL ); 25 # fwrite( $h, file_get_contents('php://input') . PHP_EOL ); 26 # fwrite( $h, print_r( json_decode( file_get_contents('php://input'), true ), true ) ); 28 $dati = json_decode( file_get_contents(
'php://input'),
true );
31 $_REQUEST[
'debug'][
'SDK_VERSION'] = Amazon\Pay\API\Client::SDK_VERSION;
40 $fileRicevuta =
'var/log/payments/amazonpay/amazonpay.starter.' . time() .
'.log';
47 'public_key_id' =>
$cf[
'ecommerce'][
'provider'][
'amazonpay'][
'profile'][
'publicKey'],
48 'private_key' =>
DIRECTORY_BASE .
'etc/amazon/'.
$cf[
'ecommerce'][
'provider'][
'amazonpay'][
'profile'][
'publicKey'].
'.pem',
49 'sandbox' => $cf[
'ecommerce'][
'provider'][
'amazonpay'][
'profile'][
'sandbox'],
55 'storeId' =>
$cf[
'ecommerce'][
'provider'][
'amazonpay'][
'profile'][
'storeId'],
56 'webCheckoutDetails' => array(
57 'checkoutReviewReturnUrl' =>
$cf[
'contents'][
'pages'][
'carrello'][
'url'][
$cf[
'localization'][
'language'][
'ietf'] ],
58 'checkoutResultReturnUrl' => $cf[
'site'][
'url'] . $cf[
'ecommerce'][
'provider'][
'amazonpay'][
'profile'][
'listener']
60 'addressRestrictions' => array(
62 'restrictions' => array(
67 $headers = array(
'x-amz-pay-Idempotency-Key' => uniqid());
69 # die( print_r( $payload, true ) ); 79 if (
$result[
'status'] === 201) {
81 $response = json_decode(
$result[
'response'],
true);
82 $checkoutSessionId = $response[
'checkoutSessionId'];
83 # echo "checkoutSessionId=$checkoutSessionId\n"; 84 buildJson( array(
'checkoutSessionId' => $checkoutSessionId ) );
85 mysqlQuery( $cf[
'mysql'][
'connection'],
'UPDATE carrelli SET session_checkout = ? WHERE id = ?', array( array(
's' => $checkoutSessionId ), array(
's' =>
$_SESSION[
'carrello'][
'id'] ) ) );
88 # echo 'status=' . $result['status'] . '; response=' . $result['response'] . "\n"; 91 }
catch (\Exception
$e) {
$cf['ricerca']['template']
if(is_array( $dati)) $_REQUEST['debug']['SDK_VERSION']
if(isset( $_REQUEST['amazonCheckoutSessionId'])) $_SESSION['carrello']