Composer を使用して Omnipay をインストールするのではなく、従来の PHP インクルードを使用して Omnipay と Stripe をセットアップします。
どうすればいいですか?私はそれをこのフォルダに抽出しました:
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();
}