0

我正在尝试通过 Omnipay 从我的 laravel 应用程序向贝宝付款。这很好用,我收到了回复,getData() 显示成功等等,但是......

我怎么知道我收到了哪笔付款?

假设我为第 100 号订单支付 1 欧元 - 如何将第 100 号订单分配给付款?

我有三种方法:

postOrder() 具有:

                $paypal_setitems = [];
                foreach(Cart::contents() as $item) {
                    $paypal_setitems[] = array('name' => $item->name, 'quantity' => $item->quantity, 'price' => ($item->price * (1 + 19.00 / 100.0) ));
                }
                # Send response to PP
                $response = $gateway->purchase($this->getApiInfos($order->id))->setItems($paypal_setitems)->send();

                return $response->redirect();  

getSuccessPayment() 具有:

    public function getSuccessPayment() {
    $gatewayFactory = new \Omnipay\Common\GatewayFactory;
    $gateway = $gatewayFactory->create('PayPal_Express');
    #Test API Sandbox
    $gateway->setUsername('buy-facilitator_api1.xxxxxx.de');
    $gateway->setPassword('xxxxx');
    $gateway->setSignature('xxxxx.xxxxx.xxxx.xxxxx');
    $gateway->setTestMode(true);

    $response = $gateway->completePurchase($this->getApiInfos())->send();
    $data = $response->getData(); // this is the raw response object

    if($data['ACK'] == 'Success'):
        echo '<pre>';
        print_r($data);
        //return Redirect::to('order/success')->with('order', $this->order);
    endif;
}  

和 getApiInfos() :

public function getApiInfos($order = NULL) {
  return array(
    'amount'=> Cart::total(),
    'cancelUrl' => \URL::route('paypal_cancel_order'),
    'returnUrl' => \URL::route('paypal_return'),
    'description' => 'Your Payment at - Order #',
    'currency' => 'EUR',
    'order' => $order
  );
}  

我试图分配'order' => $order给数组,但这不起作用。

有任何想法吗?
我只需要将成功的付款(以及 transactionId 和其他内容)保存到订单中,但我不知道如何。

4

0 回答 0