Skip to content

Instantly share code, notes, and snippets.

@beisong7
Last active February 24, 2021 09:44
Show Gist options
  • Save beisong7/8f4366b6b6f93931a3c428e7d842f0b5 to your computer and use it in GitHub Desktop.
Save beisong7/8f4366b6b6f93931a3c428e7d842f0b5 to your computer and use it in GitHub Desktop.
Payment Schematics
<?php
Schema::create('payments', function (Blueprint $table) {
$table->bigIncrements('id');
$table->uuid('uuid')->unique();
$table->uuid('member_id')->nullable(); // the person paying uuid
$table->uuid('subscription_id')->nullable(); //if you have a subscription table else delete this line
$table->uuid('transaction_id')->nullable();
$table->float('amount', 10, 2)->nullable();
$table->string('reference_id')->nullable(); //paystack or flutter reference
$table->text('comments')->nullable(); //any comment relevant to the payment
$table->boolean('success')->nullable();
$table->timestamps();
$table->foreign('transaction_id')->references('uuid')->on('transactions');
});
<?php
Schema::create('transactions', function (Blueprint $table) {
$table->bigIncrements('id');
$table->uuid('uuid')->unique();
$table->string('txref')->nullable(); //transaction ref - both paystack or flutter has
$table->string('first_name')->nullable();
$table->string('last_name')->nullable();
$table->string('email')->nullable();
$table->string('customer_id')->nullable();
$table->string('phone')->nullable();
$table->float('amount', 12, 2)->nullable();
$table->string('status')->nullable(); //attempted , successful, failed
$table->string('purpose')->nullable(); // reason of payment
$table->boolean('completed')->nullable();
$table->text('gateway_message')->nullable(); // gateway response
$table->bigInteger('start')->nullable(); // time the payment was initiated (This is for unix timestamps, you can remove it)
$table->bigInteger('ends')->nullable(); // time the payment was successful or not (This is for unix timestamps, you can remove it)
$table->timestamps();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment