# better-payment/0.0.1/includes/class-betterpayment-installer.php

Better Payment – Instant Payments, Donations, Fundraising with Subscriptions &amp; More, version 0.0.1. 45 lines.

- Page: https://pluginprobe.com/plugins/better-payment/0.0.1/code/includes/class-betterpayment-installer.php
- Raw: https://pluginprobe.com/plugins/better-payment/0.0.1/raw/includes/class-betterpayment-installer.php
- Modified: 2021-10-26T08:44:38+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/better-payment/0.0.1/code/includes/class-betterpayment-installer.php#L10-L20`.

```php
<?php
defined('ABSPATH') || exit();

class BetterPayment_Installer
{

    public static function install() {
        self::create_tables();
    }

    private static function get_schema() {
        global $wpdb;
        return [
            "CREATE TABLE IF NOT EXISTS {$wpdb->prefix}betterpayment(
         	 	id bigint(20) NOT NULL AUTO_INCREMENT,
  			 	order_id varchar(50) NOT NULL,
				transaction_id varchar(50) DEFAULT '',
			 	amount decimal(10,2) NOT NULL,
			 	status varchar(50) DEFAULT NULL,
			    source varchar(50) NOT NULL,
			    payment_date datetime DEFAULT NULL,
			    email varchar(50) NOT NULL DEFAULT '',
			    customer_info longtext,
			    form_fields_info longtext,
			    currency varchar(11) NOT NULL DEFAULT '', 
                referer varchar(64) DEFAULT NULL,
			    obj_id text,
			    PRIMARY KEY (id),
			    KEY order_id (order_id),
			    KEY status (status)						
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8 "
        ];
    }

    public static function create_tables() {
        global $wpdb;
        $wpdb->hide_errors();
        require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
        $tables = self::get_schema();
        foreach ( $tables as $table ) {
            dbDelta( $table );
        }
    }
}

```
