Wednesday, March 15, 2017

PayPal SDK (PHP) items creating dynamically from database

I'm using PayPal SDK (PHP). I'm trying to create item dynamically from database. All calculation will be done by dynamically. But i'm faile. Can anyone help me? here code:

$item_1 = new Item();
        $item_1->setName('Item 1') /** item name **/
            ->setCurrency('USD')
            ->setQuantity(1)
            ->setPrice($request->get('amount')); /** unit price **/
        $item_list = new ItemList();
        $item_list->setItems(array($item_1));
        $amount = new Amount();
        $amount->setCurrency('USD')
            ->setTotal($request->get('amount'));
        $transaction = new Transaction();
        $transaction->setAmount($amount)
            ->setItemList($item_list)
            ->setDescription('Your transaction description') 



via fsuuaas

Advertisement