【发布时间】:2017-05-11 11:02:35
【问题描述】:
我尝试使用 omnipay 实现带有 laravel 5.1 的支付墙网关。但是没有可用的确切文档或示例代码。是否有任何实现示例可用于将omnipay paymentwall 与 laravel 集成。
【问题讨论】:
标签: laravel laravel-5.1 omnipay
我尝试使用 omnipay 实现带有 laravel 5.1 的支付墙网关。但是没有可用的确切文档或示例代码。是否有任何实现示例可用于将omnipay paymentwall 与 laravel 集成。
【问题讨论】:
标签: laravel laravel-5.1 omnipay
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";
}
【讨论】: