switched to paddle inline checkout, removed paypal and most of stripe. added product sync between app and paddle.
This commit is contained in:
@@ -34,8 +34,8 @@ return new class extends Migration
|
||||
$table->string('stripe_payment_intent_id')->nullable();
|
||||
$table->string('stripe_customer_id')->nullable();
|
||||
$table->string('stripe_subscription_id')->nullable();
|
||||
$table->string('paypal_order_id')->nullable();
|
||||
$table->string('paypal_subscription_id')->nullable();
|
||||
$table->string('paddle_checkout_id')->nullable();
|
||||
$table->string('paddle_transaction_id')->nullable();
|
||||
$table->json('provider_metadata')->nullable();
|
||||
|
||||
$table->string('locale', 5)->nullable();
|
||||
@@ -47,7 +47,8 @@ return new class extends Migration
|
||||
$table->softDeletes();
|
||||
|
||||
$table->unique('stripe_payment_intent_id');
|
||||
$table->unique('paypal_order_id');
|
||||
$table->unique('paddle_checkout_id');
|
||||
$table->unique('paddle_transaction_id');
|
||||
$table->index(['provider', 'status']);
|
||||
$table->index('expires_at');
|
||||
});
|
||||
@@ -60,4 +61,4 @@ return new class extends Migration
|
||||
{
|
||||
Schema::dropIfExists('checkout_sessions');
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
if (! Schema::hasColumn('packages', 'paddle_product_id')) {
|
||||
Schema::table('packages', function (Blueprint $table) {
|
||||
$table->string('paddle_product_id')->nullable()->after('price');
|
||||
$table->string('paddle_price_id')->nullable()->after('paddle_product_id');
|
||||
$table->index('paddle_product_id');
|
||||
$table->index('paddle_price_id');
|
||||
});
|
||||
}
|
||||
|
||||
if (! Schema::hasColumn('tenants', 'paddle_customer_id')) {
|
||||
Schema::table('tenants', function (Blueprint $table) {
|
||||
$table->string('paddle_customer_id')->nullable()->after('subscription_status');
|
||||
$table->index('paddle_customer_id');
|
||||
});
|
||||
}
|
||||
|
||||
if (! Schema::hasColumn('tenant_packages', 'paddle_subscription_id')) {
|
||||
Schema::table('tenant_packages', function (Blueprint $table) {
|
||||
$table->string('paddle_subscription_id')->nullable()->after('package_id');
|
||||
$table->index('paddle_subscription_id');
|
||||
});
|
||||
}
|
||||
|
||||
if (! Schema::hasColumn('package_purchases', 'provider')) {
|
||||
Schema::table('package_purchases', function (Blueprint $table) {
|
||||
$table->string('provider')->nullable()->after('package_id');
|
||||
$table->index('provider');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
if (Schema::hasColumn('packages', 'paddle_price_id')) {
|
||||
Schema::table('packages', function (Blueprint $table) {
|
||||
$table->dropIndex('packages_paddle_price_id_index');
|
||||
$table->dropColumn('paddle_price_id');
|
||||
});
|
||||
}
|
||||
|
||||
if (Schema::hasColumn('packages', 'paddle_product_id')) {
|
||||
Schema::table('packages', function (Blueprint $table) {
|
||||
$table->dropIndex('packages_paddle_product_id_index');
|
||||
$table->dropColumn('paddle_product_id');
|
||||
});
|
||||
}
|
||||
|
||||
if (Schema::hasColumn('tenants', 'paddle_customer_id')) {
|
||||
Schema::table('tenants', function (Blueprint $table) {
|
||||
$table->dropIndex('tenants_paddle_customer_id_index');
|
||||
$table->dropColumn('paddle_customer_id');
|
||||
});
|
||||
}
|
||||
|
||||
if (Schema::hasColumn('tenant_packages', 'paddle_subscription_id')) {
|
||||
Schema::table('tenant_packages', function (Blueprint $table) {
|
||||
$table->dropIndex('tenant_packages_paddle_subscription_id_index');
|
||||
$table->dropColumn('paddle_subscription_id');
|
||||
});
|
||||
}
|
||||
|
||||
if (Schema::hasColumn('package_purchases', 'provider')) {
|
||||
Schema::table('package_purchases', function (Blueprint $table) {
|
||||
$table->dropIndex('package_purchases_provider_index');
|
||||
$table->dropColumn('provider');
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('packages', function (Blueprint $table) {
|
||||
$table->string('paddle_sync_status', 50)
|
||||
->nullable()
|
||||
->after('paddle_price_id');
|
||||
$table->timestamp('paddle_synced_at')
|
||||
->nullable()
|
||||
->after('paddle_sync_status');
|
||||
$table->json('paddle_snapshot')
|
||||
->nullable()
|
||||
->after('paddle_synced_at');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('packages', function (Blueprint $table) {
|
||||
$table->dropColumn(['paddle_sync_status', 'paddle_synced_at', 'paddle_snapshot']);
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user