2017-02-20 5 views
0

私はインターネット上のあらゆる場所を検索しようとしています。Omnipay Paypal Expressにカスタム変数を追加する

私は 'Paypal_Express' Omnipayの購入にユーザーIDを追加しようとしています。

しかし、https://github.com/thephpleague/omnipay-paypal/issues/10で概説されている解決策は私のためには機能しません。関数sendDataが存在しないことを示します。 $ request-> setTransactionId();と$ request-> setDescription();また、エラーをスローします..誰かがこれを行うことができましたか?

$order_paramaters = array(
'amount'  => $grand_total, 
); 

Omnipay::setParameter('custom', $cart->user_id); 
$response = Omnipay::purchase($order_paramaters)->send(); 

は私が取得:も試してみました

call_user_func_array() expects parameter 1 to be a valid callback, cannot access protected method Omnipay\PayPal\ExpressGateway::setParameter() 

$gateway = Omnipay::create('PayPal_Express'); 
$gateway->setParameter('custom', $cart->user_id); 
$response = $gateway->purchase($order_paramaters)->send(); 

は私が取得:

Call to protected method Omnipay\Common\AbstractGateway::setParameter() from context 'App\Http\Controllers\CartController' 

すべてのヘルプは大歓迎します。

私はこれに代えていると思い

答えて

0

$gateway = Omnipay::create('PayPal_Express'); 
$gateway->setParameter('custom', $cart->user_id); 
$response = $gateway->purchase($order_paramaters)->send(); 

あなたはこれを試してみる必要があります。

$gateway = Omnipay::create('PayPal_Express'); 
$purchase = $gateway->purchase($order_paramaters); 
$purchase->setParameter('custom', $cart->user_id); 
$response = $purchase->send(); 

すなわちcustomパラメータは、購入対象のではなく、ゲートウェイオブジェクトのパラメータです。

関連する問題