【问题标题】:paymenwall gateway integration with laravel 5.1paymenwall 网关与 laravel 5.1 的集成
【发布时间】:2017-05-11 11:02:35
【问题描述】:

我尝试使用 omnipay 实现带有 laravel 5.1 的支付墙网关。但是没有可用的确切文档或示例代码。是否有任何实现示例可用于将omnipay paymentwall 与 laravel 集成。

【问题讨论】:

    标签: laravel laravel-5.1 omnipay


    【解决方案1】:

    omnipay-paymentwall 库的类头文件中有包含使用示例的文档。

    示例

    // Create a gateway for the PaymentWall REST Gateway
    // (routes to GatewayFactory::create)
    $gateway = Omnipay::create('PaymentWall');
    
    // Initialise the gateway
    $gateway->initialize(array(
        'apiType'      => $gateway::API_GOODS,
        'publicKey'    => 'YOUR_PUBLIC_KEY',
        'privateKey'   => 'YOUR_PRIVATE_KEY',
    ));
    
    // Create a credit card object
    // This card can be used for testing.
    $card = new CreditCard(array(
                'firstName'             => 'Example',
                'lastName'              => 'Customer',
                'number'                => '4242424242424242',
                'expiryMonth'           => '01',
                'expiryYear'            => '2020',
                'cvv'                   => '123',
                'email'                 => 'customer@example.com',
                'billingPostcode'       => '4999',
    ));
    
    // Do a purchase transaction on the gateway
    $transaction = $gateway->purchase(array(
        'amount'                    => '10.00',
        'accountId'                 => 12341234,
        'currency'                  => 'AUD',
        'clientIp'                  => '127.0.0.1',
        'packageId'                 => 1234,
        'description'               => 'Super Deluxe Excellent Discount Package',
        'fingerprint'               => '*token provided by Brick.js*',
        'browserDomain'             => 'SiteName.com',
        'card'                      => $card,
    ));
    $response = $transaction->send();
    if ($response->isSuccessful()) {
        echo "Purchase transaction was successful!\n";
        $sale_id = $response->getTransactionReference();
        echo "Transaction reference = " . $sale_id . "\n";
    }
    

    【讨论】:

      猜你喜欢
      • 2016-01-06
      • 2016-12-26
      • 1970-01-01
      • 2016-03-02
      • 2018-01-25
      • 2015-11-02
      • 1970-01-01
      • 2015-12-20
      • 2017-01-06
      相关资源
      最近更新 更多