Why use same functions twice while create and executing payment

kuns25
New Community Member

Hii Im new to paypal payment gateway integration , i had install paypal php sdk via composer , then when i was checking sample codes ,

 

i was reading create payment code http://paypal.github.io/PayPal-PHP-SDK/sample/doc/payments/CreatePaymentUsingPayPal.html

and executing payment http://paypal.github.io/PayPal-PHP-SDK/sample/doc/payments/ExecutePayment.html

 

in Both Cases while creating and executing payment both using same function again and agian , please tell me the reason what is the need to use it again and again 

 

$transaction = new Transaction();
$amount = new Amount();
$details = new Details();

$details->setShipping(1.2)
->setTax(1.3)
->setSubtotal(17.50);

$amount->setCurrency('USD');
$amount->setTotal(20);
$amount->setDetails($details);
$transaction->setAmount($amount);

$execution->addTransaction($transaction);

 

when i remove above from my execute method , its giving me same response with our without this code , as i have already implemented it createpayment method.

 

 

 

Login to Me Too
0 REPLIES 0

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.