批量付款后重定向到贝宝页面

时间:2019-10-22 16:31:24

标签: php laravel paypal

我想重定向到Paypal页面,以便执行付款(两个接收方之间的批量付款);请帮忙。

我正在使用此类:

$senderBatchHeader = new \PayPal\Api\PayoutSenderBatchHeader();
$senderBatchHeader->setSenderBatchId(uniqid().microtime(true))
            ->setEmailSubject("You have a payment");
$senderItem = new \PayPal\Api\PayoutItem();
                $senderItem->setRecipientType('Email')
                    ->setNote('Thanks you.')
                    ->setReceiver('email_receiver_1')
                    ->setSenderItemId("item_1" . uniqid().microtime('true'))
                    ->setAmount(new \PayPal\Api\Currency('{
                "value":"10.0",
                "currency":"USD"
            }'));
$senderItem2 = new \PayPal\Api\PayoutItem();
                $senderItem2->setRecipientType('Email')
                    ->setNote('Thanks you.')
                    ->setReceiver('email_receiver_2')
                    ->setSenderItemId("item_2" . uniqid().microtime('true'))
                    ->setAmount(new \PayPal\Api\Currency('{
                "value":"20.0",
                "currency":"USD"
            }'));
 $payouts->setSenderBatchHeader($senderBatchHeader)->addItem($senderItem)->addItem($senderItem2);
        $request = clone $payouts;
        $apiContext = new \PayPal\Rest\ApiContext(
            new \PayPal\Auth\OAuthTokenCredential(
               $client_id,
               $secret_id
            )
        );
$output = $payouts->create(null, $apiContext);    
return $output;

0 个答案:

没有答案