2016-03-21 16 views
0

Aşağıda gördüğünüz gibi bir PayPal sanal alan işlemi oluşturdum. İyi çalışıyor. Ancak şimdi paypal sitesinde gönderim adresi iletişim kutusunu devre dışı bırakmak istiyorum. bunu buldum:PHP ile PayPal gönderim bedeli nasıl iptal edilir

$inputfields = new \PayPal\Api\InputFields(); 
$inputfields->getNoShipping(1); 

Ama işe olsun. Hala ne eksik?

$apiContext = new \PayPal\Rest\ApiContext(
new \PayPal\Auth\OAuthTokenCredential(PAYPAL_CLIENT_ID, PAYPAL_CLIENT_SECRET)); 

$amount = new Amount(); 
$amount->setCurrency('EUR'); 
$amount->setTotal($price);    
$amount->setDetails($details); 

$transaction = new Transaction(); 
$transaction->setAmount($amount) 
    ->setDescription(...) 
    ->setNotifyUrl( ...); 

$redirectUrls = new RedirectUrls(); 
$redirectUrls->setReturnUrl(...); 
    ->setCancelUrl(...);  

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

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

try { 
    $payment->create($apiContext); 
} catch (\PayPal\Exception\PayPalConnectionException $e) { } 

cevap

2

Bu eski bir soru ama yine de alakalı olduğunu düşünüyorum:

Bir profilde Inputfields sarmak zorunda (WebProfile örneğin). Daha sonra profili oluşturun ve Ödeme'ye ekleyin.

$webProfileId = $webProfile->create($apiContext)->getId(); 

$payment = new Payment(); 
$payment->setExperienceProfileId($webProfileId); 
İlgili konular