我正在使用“ 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 :(得分:0)
解决了 在测试模式下,天平不会改变,当转换为实时模式时,一切正常。