我尝试使用omnipay实现带有laravel 5.1的支付墙网关。但是没有确切的文档或示例代码可用。是否有任何实现示例可用于omnipay支付墙与laravel的集成。
答案 0 :(得分:0)
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";
}