Codeigniter 如何使用ci商户库在您的网站上处理信用卡支付选项(无需重定向到PayPale)paypalexpressceckout

Codeigniter 如何使用ci商户库在您的网站上处理信用卡支付选项(无需重定向到PayPale)paypalexpressceckout,codeigniter,paypal,codeigniter-2,ci-merchant,Codeigniter,Paypal,Codeigniter 2,Ci Merchant,我正在使用ci merchant library并成功地将其集成,同时也为paypal帐户所有者用户工作。但不知道如何为没有paypal acc且只想在我的网站上通过信用卡或借记卡付款的用户处理*(无需重定向到paypal)*有什么想法吗???abt…这是我在控制器中用于正常paypal支付的代码,效果也很好 $this->load->library('merchant'); $this->merchant->load('paypal_express')

我正在使用ci merchant library并成功地将其集成,同时也为paypal帐户所有者用户工作。但不知道如何为没有paypal acc且只想在我的网站上通过信用卡或借记卡付款的用户处理*(无需重定向到paypal)*有什么想法吗???abt…这是我在控制器中用于正常paypal支付的代码,效果也很好

    $this->load->library('merchant');
    $this->merchant->load('paypal_express');
    $settings = $this->merchant->default_settings();
        $settings = array(
        'username' => 'takeout_api1.rest.com',
        'password' => '1369227981',
        'signature' => 'AnOQDpMvzNQqHN5u7vb9BKLaKYLoALq6R0g3ohOwD4RQgO0DQDI5l7V4',
        'test_mode' => true,
        );


    $this->merchant->initialize($settings);
    $params = array(
        'amount' => 1500.00,
        'currency' => 'CAD',
        'return_url' => 'http://192.168.1.7/takeout/order_detail/test',
        'cancel_url' => 'http://192.168.1.7/takeout/order_detail/test');

        $response = $this->merchant->purchase($params);

function test()
    {

    $settings = array(
    'username' => 'takeout_api1.rest.com',
    'password' => '1369227981',
    'signature' => 'AnOQDpMvzNQqHN5u7vb9BKLaKYLoALq6R0g3ohOwD4RQgO0DQDI5l7V4',
    'test_mode' => true);
$this->merchant->initialize($settings);

$params = array(
    'amount' => 1500.00,
    'currency' => 'CAD',
    'return_url' => 'http://192.168.1.7/takeout/order_detail/test',
    'cancel_url' => 'http://192.168.1.7/takeout/order_detail/test');
    $response = $this->merchant->purchase_return($params);
    if ($response->success())
{
    // mark order as complete
    echo "yo";
    exit;
}
else
{
    $message = $response->message();
    echo('Error processing payment: ' . $message);
    exit;
}


    }

您可以连接您的商户服务 贝宝 信用卡/借记卡 现在在您的表单中,有一个小单选按钮组,并要求用户选择 贝宝或信用卡/借记卡

<label>Choose a payment Method</label>

<label>Paypal<label>
<input type="radio" name="merchant" value="paypal" />

<label>Credit/Debit Card<label>
<input type="radio" name="merchant" value="debit" />
控制器 编辑以回答您的评论 我只是以Realex为例

您需要找出这两个库的共同点,或者在非常低的抽象级别上找出它们共享的内容

例如

  • 它们都需要一个初始化方法来配置选项
  • 它们都需要向API发送请求
  • 他们两人都需要一次回应
  • 等等,不要抽象
如何处理这些问题,将是库本身所独有的

interface merchantServiceInterface
{
    // Use the facade design pattern here
    // so configuration is done in each library
    public function initialize();

    // Send a request with data 
    // Paypal - use http_build_query and curl
    // Realex - use xml and curl
    public function request(array $data);

    public function responce();
}
Paypal Express Checkout不支持在您的网站上使用信用卡。它是一个非现场网关,因此必须重定向


您需要探索使用PayPal Pro、Payflow或任何其他支持直接在您的网站上接受信用卡的网关(加上附带的额外PCI要求).

hi philip.我完全明白了…你发布的这个流程我已经知道了这个流程…我只需要知道信用卡/借记卡的初始化、购买和购买返回方法(在relax类中)中应该包含什么内容…当然,根据他们说的支持的链接,这不能与我的支付方式相同。。。但我在ci merchant lib和API中都找不到任何与之相关的东西。由于流程图具有误导性,我只能假设它们的意思是“如何将paypal添加到您已经接受信用卡的现有网站”。Paypal Express仅托管。您的客户不必拥有paypal帐户,但他们必须在paypal的网站上输入其卡的详细信息,不是你的。好的…谢谢你的宝贵意见…我会检查一下,然后再给你回复,因为我也看过他们提到的视频,你可以在你自己的网站上做…否则我必须转到Payparpro…再次感谢你的反馈和帮助
class Realex implements merchantServiceInterface
{
    public function initialize(){}

    public function purchase(){}

    public function purchase_return(){}
}
<label>Choose a payment Method</label>

<label>Paypal<label>
<input type="radio" name="merchant" value="paypal" />

<label>Credit/Debit Card<label>
<input type="radio" name="merchant" value="debit" />
class Merchant
{
    protected $_service;

    public function __construct(merchantServiceInterface $service)
    {
        $this->_service = $service;
    }

    public function initialize()
    {
        // Will either run Paypal/Realex initialize()
        // Depending on what instance was passed to _service
        //
        $this->_service->initialize();
    }
}
class Controller extends CI_Controller
{
    public function method()
    {
        if($this->input->post('merchant') == 'paypal')
        {
            $service = new Paypal();
        }

        elseif($this->input->post('merchant') == 'debit')
        {
            $service = new Realex();
        }

        $this->load->library('Merchant', $service);
        $this->merchant->initialize();
    }
}
interface merchantServiceInterface
{
    // Use the facade design pattern here
    // so configuration is done in each library
    public function initialize();

    // Send a request with data 
    // Paypal - use http_build_query and curl
    // Realex - use xml and curl
    public function request(array $data);

    public function responce();
}