我不想使用 composer 来安装 Omnipay,而是使用传统的 PHP 包含来设置带有 Stripe 的 Omnipay。
我该怎么做呢?我已将其提取到此文件夹:
www.mysite.com/payments/src
带有示例代码的 Stripe.php 在这里:
www.mysite.com/payments/Stripe.php
我在哪里放置条带支付网关文件?我需要在标头示例代码中包含哪些 PHP 文件?
我正在使用这个示例代码:
include $_SERVER['DOCUMENT_ROOT']."/payments/src/Omnipay/Omnipay.php";
use Omnipay\Omnipay;
$gateway = Omnipay::create('Stripe');
$gateway->setApiKey('abc123');
$formData = ['number' => '4242424242424242', 'expiryMonth' => '6', 'expiryYear' => '2016', 'cvv' => '123'];
$response = $gateway->purchase(['amount' => '10.00', 'currency' => 'USD', 'card' => $formData])->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();
}