PayPal Integration SandBox does not work!

2
Hello, good morning can someone help me with a problem I'm having in the integration Rest Restore SDI from PayPal.

I put the code below, it seems to run perfectly, however when I go in "Transactions" in the paypal sandbox there is no transaction. Can anyone tell me what it is?

CODE

use PayPal\Rest\ApiContext;
use PayPal\Auth\OAuthTokenCredential;
use PayPal\Api\Payer;
use PayPal\Api\Item;
use PayPal\Api\ItemList;
use PayPal\Api\Details;
use PayPal\Api\Amount;
use PayPal\Api\Transaction;
use PayPal\Api\RedirectUrls;
use PayPal\Api\Payment;

require dirname( dirname( __FILE__ ) ) . "/autoload.php";

$api = new ApiContext(
    new OAuthTokenCredential(
        '{CLIENT_ID}',     // ClientID
        '{CLIENT_SECRECT}'      // ClientSecret
    )
);

$api->setConfig(
    array(
        'mode'                      => 'sandbox',
        'http.ConnectionTimeOut'    => 30,
        'log.LogEnable'             => false,
        'log.FileName'              => '',
        'log.LogLevel'              => 'FINE',
        'validation.level'          => 'log'
    )
);

/**
 * Payer

$payer = new Payer();
$payer->setPaymentMethod('paypal');

$item = new Item();
$item->setName('Item 1');
$item->setCurrency('USD');
$item->setPrice('2');
$item->setQuantity(1);

$itemList = new ItemList();
$itemList->setItems(array($item));

$details = new Details();
$details->setSubtotal('2');

$amount = new Amount();
$amount->setCurrency('USD');
$amount->setTotal('2');
$amount->setDetails($details);

$transaction = new Transaction();
$transaction->setAmount( $amount );
$transaction->setItemList($itemList);

$urls = new RedirectUrls();
$urls->setReturnUrl('{URL}');
$urls->setCancelUrl('{URL}');

$payment = new Payment();
$payment->setIntent('sale');
$payment->setPayer($payer);
$payment->setTransactions(array($transaction));
$payment->setRedirectUrls($urls);

try {
    $payment->create( $api );
} catch (Exception $e) {
    die($e);
}

header("location:" . $payment->getApprovalLink() );

I can finish the "buy" normally with the buyer user that the sandbox creates, but nothing to appear the transactions.

    
asked by anonymous 30.11.2015 / 05:20

1 answer

1

All you need to know about integration with Express Checkout within Brazil, you can find on the PayPal website, for example #

    
11.12.2015 / 16:37