我正在使用“ Omnipay与PayPal Express Checkout [symfony2.5]集成”,这是对课程的暗示命名空间Atcop \ BookBundle \ Libs;使用Omnipay \ Common \ GatewayFactory;贝宝类{protected $gateway = null;private static $CURRENCY = "USD";public function __construct() { $this->gateway = GatewayFactory::create('PayPal_Express'); $this->gateway->setUsername('*********'); $this->gateway->setPassword('**********'); $this->gateway->setSignature('**************'); $this->gateway->setTestMode(true);}public function sendPurchase($parameters = []){ $payArray = [ 'amount' => 58.00, 'description' => $parameters['description'], 'currency' => self::$CURRENCY, 'transactionId' => $parameters['transactionId'], 'returnUrl' => $parameters['returnUrl'], 'cancelUrl' => $parameters['cancelUrl'] ]; return $this->gateway->purchase($payArray)->send();}public function complete($reference, $payerId) { $completePayData = [ 'amount' => 58.00, 'description' => 'Buy the currencies book - step by step', 'transactionReference' => $reference, 'payerId' => $payerId, ]; $response = $this->gateway->completePurchase($completePayData)->send(); if($response->isSuccessful()){ return $response->getData(); } return false;}}完成后一切都很好,我在仪表板上看到该交易的通知和收据,但商人和买方的余额没有变化。
添加回答
举报
0/150
提交
取消