> For the complete documentation index, see [llms.txt](https://asiabill.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://asiabill.gitbook.io/docs/cha-jian-ping-tai/kai-yuan-zi-jian-zhan/magento2.md).

# Magento2

请先阅读[开源自建站说明](/docs/cha-jian-ping-tai/kai-yuan-zi-jian-zhan.md)

{% hint style="info" %}
插件版本：2.1.1
{% endhint %}

### 安装插件

1. 下载插件：<https://github.com/Asiabill/asiabill_plugin_magento2>
2. 解压后把<mark style="color:orange;">`Asiabill`</mark>目录上传到站点<mark style="color:orange;">`app/code`</mark>目录中
3. 打开终端并在 Magento 目录中运行以下命令

```shell
php bin/magento setup:upgrade
php bin/magento cache:flush
php bin/magento cache:clean
```

&#x20; 4\. 如果您在生产模式下运行 Magento，您还必须编译和部署模块的静态文件。

```shell
php bin/magento setup:di:compile
php bin/magento setup:stat
```

### 插件设置

进入后台<mark style="color:purple;">Stores</mark> -> <mark style="color:purple;">Configuration</mark> -> <mark style="color:purple;">Sales</mark> -> <mark style="color:purple;">Payment Methods</mark> 可以看到：<mark style="color:orange;">Asiabill Payment</mark>

![](/files/BUEpksKi6QehIQc7yGvP)

#### Basic Setting：基础设置

* Version：版本信息
* Mode：模式
  * test：测试
  * live：正式
* Test Mer No、Test Gateway No、Test Sign Key：测试账户信息，测试模式下使用，默认已设置
* Icons Location：图标显示位置
* Start Log：开启支付数据日志
* Success Order：交易成功更新订单状态
* Failure Order：交易失败更新订单状态
* Outstanding Order：待处理订单更状态
* Webhook：是否接受异步订单回调
* Webhook URL：异步回调通知地址

#### Credit Card Payment：信用卡支付

* Enabled：是否开启
* Title：显示支付方式名称
* Checkout Model：支付模式
  * Asiabill Elements ：内嵌表单模式
  * Asiabill Checkout ：托管模式（重定向）
* Elements Style：内嵌表单样式，单行/双行
* Mer No、Gateway No、Sign Key：账户信息，非测试模式下使用
* Select Card Icons：显示卡种图标
* Payment from Applicable Countries：适用支付国家
* Sort Order：排序

#### Digital Wallets：电子钱包

Alipay和Wechat

#### Local Payments：本地支付

Crypto、Ebanx、Directpay、Giropay、Ideal、P24、Paysafe Card、Korea card、Kakaopay

### 信用卡支付

{% tabs %}
{% tab title="站内支付" %}

* 在购物网站选择商品到结算页面&#x20;
* 选择<mark style="color:orange;">信用卡支付</mark> ，支付页面将内嵌到商户支付列表中，有利于支付体验
* 直接在商户网站输入卡信息，完成支付

![](/files/C80taF4gT0KXq3cz6Ztu)
{% endtab %}

{% tab title="跳转支付" %}

* 在购物网站选择商品到结算页面&#x20;
* 选择<mark style="color:orange;">信用卡支付</mark>&#x20;
* 网站将重定向到<mark style="color:orange;">AsiaBill支付页面</mark>，输入卡信息，完成支付

![](/files/KfbMSEJbS3ymXL983kWu)
{% endtab %}
{% endtabs %}

测试卡号：[查看](/docs/cha-jian-ping-tai/kai-yuan-zi-jian-zhan.md)

### 本地支付

其它本地支付都是三方托管支付模式，测试能跳转至第三方支付页面即可。
