NEM決済導入マニュアル(EC-CUBE3系)
1. プラグインファイルを取得
以下のURLをクリックし、プラグインファイル(NemPay.tar.gz)をダウンロードします。
http://nem-ec.tech/eccube3/download/NemPay.tar.gz
2. インストール手順
以下の手順に従ってプラグインのインストールを行います。
(1) プラグイン一覧画面に遷移
[オーナーズストア > プラグイン > プラグイン一覧]をクリックします。
(2) プラグイン登録
独自プラグインの「プラグインのアップロードボタンはこちら」ボタンをクリックします。
(3) プラグインファイル選択
ダウンロードしたプラグインファイル(NemPay.tar.gz)を選択してください。
(4) プラグインインストール
ファイル選択後、「アップロード」ボタンをクリックします。
(5) プラグイン有効化
インストールが完了しました。
「有効にする」リンクをクリックすると、プラグインを有効にすることができます。
3. NEM決済の設定
次にNEM決済の設定を行います。
(1) NEM決済設定画面に遷移
「設定」リンクをクリックし、プラグイン設定画面を表示します。
(2) NEM決済の設定
環境切り替え:利用状況に合わせて選択してください。
テスト環境=testnet 本番環境=mainnet出品者アカウント(入金先):店舗の入金先アドレスを入力してください。
テスト環境=「T〜」で始まるアドレス 本番環境=「N〜」で始まるアドレス
4. 入金確認設定
入金を検知するために入金確認プログラムを自動実行の設定を行います。 サーバにアクセスし、EC-CUBEのトップディレクトリに移動してください。
cd /var/www/html/eccube-3.0.15
※「/var/www/html/eccube-3.0.15」はサーバのディレクトリ構成に合わせ適宜変更してください。
(1) 入金通知コマンドを追加
EC-CUBEに入金通知コマンドを追加するため、app/consoleを編集します。
$ vim app/console
末尾から2行目に1行追加します。
#!/usr/bin/env php <?php require_once __DIR__.'/../autoload.php'; $app = \Eccube\Application::getInstance(); $app->initialize(); // Console $app->register( new \Knp\Provider\ConsoleServiceProvider(), array( 'console.name' => 'EC-CUBE', 'console.version' => \Eccube\Common\Constant::VERSION, 'console.project_directory' => __DIR__."/.." ) ); // Migration $app->register(new \Dbtlr\MigrationProvider\Provider\MigrationServiceProvider(), array( 'db.migrations.path' => __DIR__.'/../src/Eccube/Resource/doctrine/migration', )); $app->initializePlugin(); $app->boot(); $console = $app["console"]; //ヘルパー追加 $console->getHelperSet()->set(new \Symfony\Component\Console\Helper\QuestionHelper(), 'question'); $console->add(new Eccube\Command\RouterCommand()); $console->add(new Eccube\Command\CacheClearCommand()); $console->add(new Eccube\Command\PluginCommand()); $console->add(new Eccube\Command\ConfigCommand()); // ** 追加 ** $console->add(new Plugin\NemPay\Command\PaymentConfirmBatchCommand(new Eccube\Application())); $console->run();
コマンドが追加されているか確認します。
$ app/console EC-CUBE version 3.0.15 Usage: command [options] [arguments] Options: -h, --help Display this help message -q, --quiet Do not output any message -V, --version Display this application version --ansi Force ANSI output --no-ansi Disable ANSI output -n, --no-interaction Do not ask any interactive question -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug Available commands: help Displays help for a command list Lists commands cache cache:clear Clear the cache of Application. debug debug:config Shows a list of config file migrations migrations:diff Generate a migration by comparing your current database to your mapping information. migrations:execute Execute a single migration version up or down manually. migrations:generate Generate a blank migration class. migrations:migrate Execute a migration to a specified version or the latest available version. migrations:status View the status of a set of migrations. migrations:version Manually add and delete migration versions from the version table. plugin plugin:develop plugin commandline installer. router router:debug Displays current routes for an application nempay nempay:payment_confirm 入金確認バッチ処理
最後の行に「入金確認バッチ処理」と追加されていることを確認します。
(2) 自動実行設定
追加した「入金確認バッチ処理」を自動起動します。
$ crontab -e
ファイルの最終行に下記を追加して、保存して下さい。
*/5 * * * * cd /var/www/html/eccube-3.0.15; app/console nempay:payment_confirm
※保存するには「:wq」と入力します。 ※上記は5分おきにプログラムを実行します。
5. お問い合わせ
当記事へのコメント、もしくはTwitterでDMを頂ければサポートさせて頂きます。
6. 当プラグインのソースコード
GitHubに当プラグインのソースコードを開示しています。