Omnipay PayPal Express 是否有信用卡功能?还是只能在 PayPal Pro 中使用?

2023-12-24

这个问题可能类似于THIS https://stackoverflow.com/questions/28218397/using-paypal-pro-in-omnipay and THIS https://stackoverflow.com/questions/18495788/setting-shipping-info-in-omnipay但我不完全确定。

我制作了一个购物车,在结帐时将产品详细信息和数量/总金额发送到 Paypal。我正在使用 Laravel 4 和 Omnipay Paypal 插件 (Paypal_Express)。我可以使用“setItems”功能发送产品详细信息,现在我希望使用我的用户详细信息预先填充 Paypal 摘要页面上的信用卡字段。

我在其他 SO 线程中看到过,例如THIS https://stackoverflow.com/questions/27490438/use-paypal-pro-instead-of-paypal-express-omnipay-for-laravel其他人使用信用卡功能将详细信息传递到 Paypal 摘要信用卡信息页面。

我的问题: 1)您是否需要使用 Paypal_Pro 才能使用信用卡功能? 当我尝试时出现此错误(call_user_func_array() expects parameter 1 to be a valid callback, class 'Omnipay\Common\GatewayFactory' does not have a method 'creditCard').

我不想输入所有信用卡详细信息 - 只需输入用户姓名、地址等即可加快流程...

我也尝试更改为 Paypal_Pro,但没有成功。 (与上面相同的错误)我更改了支付控制器中的配置和网关。

2)如何将PayPal_Express更改为PayPay_Pro?

My code:

 public function postPayment() { 


        $cart = Session::get('cart'); 

        $allProducts = [];

        foreach($cart->aContents as $productID=>$quantity){

            $product = Product::find($productID);

            // get the product id
            // load the product from the id
            // store data in the allProduct array
            $allProducts[] = array('name' => $product->name, 'quantity' => $quantity, 'price'=> $product->price);
        }

        $cardInput = array(

            'first_name' => Input::get('first_name'),
            'last_name' => Input::get('last_name'),
            'address1' => Input::get('address1'),
            'city' => Input::get('city'),
            'zip' => Input::get('zip'),
            'email' => Input::get('email')

            );

        $card = Omnipay::creditCard($cardInput);

        $params = array( 
            'cancelUrl' => \URL::to('cancel_order'), 
            'returnUrl' => \URL::to('payment_success'), 
            'amount' => Input::get('price'), 
            'currency' => Input::get('currency'), 
            'card' => $card,    

            ); 

            Session::put('params', $params); 

            Session::save(); 

            $gateway = Omnipay::create('PayPal_Express'); 

            $gateway->setUsername('tjmusicmanagement-facilitator_api1.gmail.com'); 

            $gateway->setPassword('K2LWQVP2L8472BPY'); 

            $gateway->setSignature('AwTOuAJWzCkdc5PldYeiz.l3iy5UAwOucYW6EFLLA9zUQqXaWyEGbebq'); 

            $gateway->setTestMode(true); 

            $gateway->setLogoImageUrl(URL::to('images/logoSmall.png'));


            $response = $gateway->purchase($params)->setItems($allProducts)->send(); 

            if ($response->isSuccessful()) { 
            // payment was successful: update database
                 print_r($response); 

                }  elseif ($response->isRedirect()) { 

                // redirect to offsite payment gateway 
                    $response->redirect(); 

                } else { 

                    // payment failed: display message to customer 
                    echo $response->getMessage();

                 } 

            } 

而且 ignited\laravel-omnipay\config.php 也没有更改(尽管我确实尝试更改驱动程序)

返回数组(

// The default gateway to use
'default' => 'paypal',

// Add in each gateway here
'gateways' => array(
    'paypal' => array(
        'driver' => 'PayPal_Express',
        'options' => array(
            'solutionType' => '',
            'landingPage' => '',
            'headerImageUrl' => ''
        )
    )
)

);

谢谢你的时间!!

编辑:这是我的 getSuccessPayment 函数,我希望可以从 paypal 获取用户的 paypal 详细信息(只是姓名和地址等)。但我如何以及在哪里指定这一点呢?

    public function getSuccessPayment() 
            {   
                $gateway = Omnipay::create('PayPal_Express');
                $gateway->setUsername('lillyloverofwar-facilitator_api1.gmail.com'); 
                $gateway->setPassword('U6LM3SG2MNCA3QE2'); 
                $gateway->setSignature('AJVP9tUtdotIeVt82RpcG7n9ld-tAdCG1Ramb1u8yZECHhSpiXc0BO04'); 
                $gateway->setTestMode(true); 

                $params = Session::get('params'); 

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

                if(isset($paypalResponse['PAYMENTINFO_0_ACK']) && $paypalResponse['PAYMENTINFO_0_ACK'] === 'Success') {

                    // return View::make('successfulPayment')->with($params); 
                 //     Session::flush();
                 // Response 
                 // print_r($paypalResponse); 
                 } else { 
                 //Failed transaction 
                 } 
                 // FLUSHING SESSION HERE GETS AN ERROR
                 // Session::flush();
                 return View::make('successfulPayment'); 


                } 

1) 当我尝试时出现此错误(call_user_func_array() 期望参数 1 是有效的回调,类“Omnipay\Common\GatewayFactory”没有方法“creditCard”)。

您不能在 PayPal Express 网关上使用信用卡,只能在 Pro 或 REST 上使用信用卡。我建议您使用 REST 网关而不是 Pro 网关(REST 取代 Pro 并具有更多功能)。

我不想输入所有信用卡详细信息 - 只需输入用户姓名、地址等即可加快流程...

如果您使用的是 PayPal Express,则无需这样做,因为在用户完成 PayPal 登录流程并授权交易后,PayPal 会向您提供必要的详细信息。

我也尝试更改为 Paypal_Pro,但没有成功。 (与上面相同的错误)我更改了支付控制器中的配置和网关。

2)如何将PayPal_Express更改为PayPay_Pro?

我建议你看看我的omnipay-paypal 网关分支,https://github.com/delatbabel/omnipay-paypal https://github.com/delatbabel/omnipay-paypal-- 在接受贝宝支付分支上有额外的提交(作为 PR 发送到主存储库但尚未合并)以及其他功能,例如使用 REST 网关进行信用卡或 PayPal 购买,以及其他 API 文档,包括有关如何使用 REST 网关的代码示例。

以下是使用 Rest 网关通过信用卡进行购买交易的代码示例:

// Create a gateway for the PayPal RestGateway
// (routes to GatewayFactory::create)
$gateway = Omnipay::create('RestGateway');

// Initialise the gateway
$gateway->initialize(array(
    'clientId' => 'MyPayPalClientId',
    'secret'   => 'MyPayPalSecret',
    'testMode' => true, // Or false when you are ready for live transactions
));

// Create a credit card object
// DO NOT USE THESE CARD VALUES -- substitute your own
// see the documentation in the class header.
$card = new CreditCard(array(
            'firstName' => 'Example',
            'lastName' => 'User',
            'number' => '4111111111111111',
            'expiryMonth'           => '01',
            'expiryYear'            => '2020',
            'cvv'                   => '123',
            'billingAddress1'       => '1 Scrubby Creek Road',
            'billingCountry'        => 'AU',
            'billingCity'           => 'Scrubby Creek',
            'billingPostcode'       => '4999',
            'billingState'          => 'QLD',
));

// Do a purchase transaction on the gateway
$transaction = $gateway->purchase(array(
    'amount'        => '10.00',
    'currency'      => 'AUD',
    'description'   => 'This is a test purchase transaction.',
    'card'          => $card,
));
$response = $transaction->send();
if ($response->isSuccessful()) {
    echo "Purchase transaction was successful!\n";
    $sale_id = $response->getTransactionReference();
    echo "Transaction reference = " . $sale_id . "\n";
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Omnipay PayPal Express 是否有信用卡功能?还是只能在 PayPal Pro 中使用? 的相关文章

随机推荐

  • 清理本机反应项目

    如何清理反应本机项目 有什么方法可以像清理 xcode 项目一样清理 React Native 项目吗 任何帮助将不胜感激 一个反应原生项目是关于一个Xcode项目和一个安卓项目 对于纯js代码 不需要clean 所以 你需要的是 清理 X
  • 使用 Javascript 在帧之间传递数据

    我已经设置了一个简单的例子http ryanmalin co uk frames http ryanmalin co uk frames 如果您按 添加 它将把左侧框架中的表单数据粘贴到右侧框架中 当我将正确的框架 URL 更改为另一个域的
  • 在 JAX-RS Provider 中使用 @Context 向 CDI bean 提供上下文信息

    我有一些网络服务 JAX RS WildFly 9 Resteasy RequestScoped public class SomeService operations 现在我想提取上下文信息 例如用户代理 这可以使用 Context pr
  • jQuery - 从所选选项获取自定义属性

    鉴于以下情况
  • 使用批处理脚本附加文件夹名称并加 1

    我对批处理脚本的这一部分有点陌生 但我想做的是附加一堆文件夹名称并递增 1 同时尊重时间戳 即最新的文件夹在前 最旧的文件夹在最后 我看过其他脚本没有效果 Before Folder 1 Folder 2 Folder 3 Folder 4
  • 仅在时间序列中填充有限数量的 NA

    有什么办法可以让我们填补NAs in a zoo or xts数量有限的对象NA向前 换句话说就像填充NA最多连续 3 个NAs 然后保留NA从第 4 个值开始直到有效数字 像这样的东西 library zoo x lt zoo 1 20
  • 自动布局 UILabels

    我有三个UILabels按照我的习惯UITableViewCell 这可能是一些UILabels将是空的 label text UITableViewCell tableView UITableView tableView cellForR
  • 在 R 中为逻辑回归模型绘制多条 ROC 曲线

    我有一个逻辑回归模型 使用 R 作为 fit6 lt glm formula survived ascore gini failed data records family binomial summary fit6 我在用着pROC用于绘
  • Javascript通知解决方案库:桌面、声音、弹出、标题栏闪烁等

    是否有任何 Javascript 库支持在长时间运行的操作 例如上传 结束时发出通知 通知最好是通用的 这样即使某些技术不起作用 例如桌面通知 浏览器仍然能够引起注意 声音铃声 桌面通知 Chrome Stackoverflow com 风
  • 在Python中解析JSON时出现各种错误

    尝试从需要登录的 url 解析 json 在这里包括我的所有代码 因为我不确定错误在哪里 try import simplejson as json except ImportError import json import urllib2
  • 使用 .after() 添加 html 关闭和打开标签

    我试图通过找到列表的中间点并添加将无序列表分成两列 ul 在那之后 这可能是完全错误的方法 但这是我的想法 我的js看起来像这样 container ul each function var total this children leng
  • 有没有办法在 Racket 中查看 lambda 的主体?

    假设我有这段代码 lang racket define a x x y y z w w z 我凭直觉知道这个 lambda 表达式 扩展地 等于 z z 我的问题是是否有办法打印出正文a如果我想看看 Racket 在内部简化了多少功能 更多
  • 如何从数组元素中删除字符?

    我有一个像这样的数组 ee 3 4 22 22 我想删除逗号 或将其替换为 34使数组看起来像这样 ee 3 4 22 22 or this ee 3 4 34 22 34 22 34 原因是我试图将该数组从 Ruby 传递到 JavaSc
  • Asp Core 发布时错误的程序集重定向

    使用 Visual Studio 发布我的 ASP Core 项目时 config文件与我的可执行文件一起创建 The config包括几个bindingRedirect像这样
  • NIO SocketChannel 读取超时? [复制]

    这个问题在这里已经有答案了 如果连接建立后一段时间内没有收到数据 设置超时关闭 NIO SocketChannel 的最佳方法是什么 Either 您正在使用一个Selector 在这种情况下 您可以选择一个可以使用的超时 如果超时 sel
  • 如何手动创建 Apache Windows 服务

    我在尝试安装另一个 Apache Web 服务器时不小心删除了 Apache Windows 服务 有谁知道如何从 cmd 创建另一个 Apache Windows 服务 我尝试了 sc create 但最后缺少一个脚本 例如 k star
  • @PreAuthorize 和 hasPermission() 执行代码两次

    我想使用 PreAuthorize Spring 注释来控制应用程序中的访问 问题是 我有很多条件不取决于请求参数 而是取决于数据库实体 概述 我有一个Route实体 具有User owner场地 您可以删除Route仅当您是所有者时 我已
  • 为什么 tanh 在我的机器上比 exp 快?

    这个问题源于一个单独的问题 https stackoverflow com questions 43033593 why is using tanh definition of logistic sigmoid faster than sc
  • 如何从 R 中的帮助页面获取文本数据?

    在全球范围内 我有兴趣从 R 文档中获取所有文本数据 将它们放入数据框架中并应用文本挖掘技术 包级别 假设我对一个包感兴趣 例如 utils 并且我想获取向量中的所有文本数据 这有效 package d lt packageDescript
  • Omnipay PayPal Express 是否有信用卡功能?还是只能在 PayPal Pro 中使用?

    这个问题可能类似于THIS https stackoverflow com questions 28218397 using paypal pro in omnipay and THIS https stackoverflow com qu