0

Omnipay 経由で laravel アプリからペイパルに支払いを送信しようとしています。これは正常に動作し、応答が返ってきました。 getData() は Success などを示していますが...

どの支払いを受け取ったかを知るにはどうすればよいですか?

注文番号 100 に対して 1 ユーロを支払うとします。注文番号 100 を支払いに割り当てるにはどうすればよいですか?

私には3つの方法があります:

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