diff --git a/vietnam-payment-gateways.php b/vietnam-payment-gateways.php
index d2c23be..bb470c1 100644
--- a/vietnam-payment-gateways.php
+++ b/vietnam-payment-gateways.php
@@ -145,8 +145,16 @@ function vnpg_init_gateway_class() {
// Get order and store in $order.
$order = wc_get_order($order_id);
+ // Get VietQR Image URL and Pay URL
+ $data = $this->get_vietqr_img_url($order_id);
+ $qrcode_image_url = $data['img_url'];
+ $qrcode_page_url = $data['pay_url'];
+
$html = '
Thông tin thanh toán
';
$html .= 'Bạn vui lòng chuyển khoản theo thông tin dưới đây
';
+ $html .= '
+
 . ')
+
';
$html .= '';
$html .= '- Số tiền: '. $order->get_total() . '
';
$html .= '- Ngân hàng: '. $this->bank . '
';
@@ -186,5 +194,27 @@ function vnpg_init_gateway_class() {
}
+ public function get_vietqr_img_url($order_id) {
+
+ // Get order and store in $order.
+ $order = wc_get_order($order_id);
+
+ $accountNo = $this->account_number;
+ $accountName = $this->account_name;
+ $bank = $this->bank;
+ $amount = $order->get_total();
+ $info = $account_fields['memo']['2value'];
+
+ $template = $this->template_id;
+
+ $img_url = "https://img.vietqr.io/image/{$bank}-{$accountNo}-{$template}.jpg?amount={$amount}&addInfo={$info}&accountName={$accountName}";
+ $pay_url = "https://api.vietqr.io/{$bank}/{$accountNo}/{$amount}/{$info}";
+
+ return array(
+ "img_url" => $img_url,
+ "pay_url" => $pay_url,
+ );
+ }
+
}
}
\ No newline at end of file