我正在使用"Omnipay与PayPal Express Checkout [symfony2.5]的集成"这是对班级的暗示
命名空间 atcop\BookBundle\Libs;
使用 Omnipay\Common\GatewayFactory;
类 PayPal {
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;
}
}
完成后一切正常,我在仪表板中看到该交易的通知和收据,但商家和买家???!!!余额没有变化
它解决了在测试模式下,平衡不会改变,当转换为实时模式时,一切都很好。