Skip to content

Integration Development

Learn how to create custom integrations for e-commerce platforms in the Gateway. This guide covers the complete process from seeder configuration to integration class implementation.

Creating a Gateway integration involves three main steps:

Define integration parameters and resources in ServicesSeeder.php and AppServicesSeeder.php.

Implement OAuth2 authorization if your platform requires it, using AuthorizationServiceTrait.

Create the integration class implementing IntegrationInterface with required methods.

graph TD
A[E-commerce Platform] -->|OAuth2| B[Gateway]
B -->|Background Jobs| C[Integration Class]
C -->|API Calls| A
C -->|Map Data| D[Standard Classes]
D -->|Send to| E[WMS/App]
F[ServicesSeeder] -->|Configure| B
G[AppServicesSeeder] -->|Define Resources| B
ComponentPurposeFile Location
Service SeederDefine integration metadata & parametersdatabase/seeders/ServicesSeeder.php
App Service SeederDefine resources & subscriptionsdatabase/seeders/AppServicesSeeder.php
Authorization TraitImplement OAuth2 flowsapp/Traits/AuthorizationServiceTrait.php
Integration ClassCore integration logicapp/Classes/{Platform}Integration.php
Data Mapping ClassesStandardized data structuresapp/Classes/{Order,Item,Address}.php
database/seeders/ServicesSeeder.php
[
'name' => 'MyPlatform',
'type' => 'myplatform',
'oauth_required' => true,
'params' => [
[
'name' => 'api_key',
'type' => 'text',
'label' => 'API Key',
'required' => true
]
]
]
database/seeders/AppServicesSeeder.php
[
'service_type' => 'myplatform',
'resources' => [
[
'name' => 'get_orders',
'label' => 'Import Orders',
'schedulable' => true
]
]
]
app/Classes/MyPlatformIntegration.php
class MyPlatformIntegration implements IntegrationInterface
{
public function getOrders(array $request)
{
// Fetch orders from platform API
}
public function mapOrder($orderData)
{
// Map to Gateway Order class
}
// ... other required methods
}

All integrations must implement 6 required methods from IntegrationInterface:

MethodPurposeReturns
getOrders()Fetch orders from platformArray of mapped orders
mapOrder()Convert platform order to Gateway formatOrder object
acknowledgeOrders()Mark orders as acknowledgedStatus response
updateTracking()Send tracking updatesStatus response
syncInventory()Sync inventory levelsStatus response
rules()Validation rulesArray of validation rules

View complete IntegrationInterface →

All integrations use standardized Gateway classes:

  • Order - Order data
  • Item - Line item data
  • Address - Base address class
  • ShippingAddress - Shipping address
  • BillingAddress - Billing address
  • ShippingService - Shipping options
  • Product - Product/inventory data
  • Shipment - Tracking data

Learn about data mapping →

  1. Research Platform API

    • Review API documentation
    • Identify authentication method
    • Map API endpoints to Gateway resources
  2. Configure Seeders

    • Add service in ServicesSeeder.php
    • Define resources in AppServicesSeeder.php
    • Run migrations: php artisan db:seed
  3. Implement OAuth2 (if required)

    • Add authorization methods
    • Implement missingParameters()
    • Implement addParametersRequest()
  4. Create Integration Class

    • Implement required methods
    • Map platform data to Gateway classes
    • Add error handling
  5. Test Integration

    • Install via Gateway UI
    • Test order import
    • Test tracking updates
    • Verify data mapping
  6. Deploy

    • Commit code
    • Deploy to staging
    • Run seeders
    • Test with real account

Service Type: lowercase, no spaces (shopifyv2, amazon, woocommerce)

Integration Class: PascalCase + Integration (ShopifyV2Integration)

Resource Names: snake_case (get_orders, update_tracking)

[
'name' => 'order_status',
'type' => 'multiselect',
'label' => 'Order Status',
'required' => true,
'items' => [
['value' => 'open', 'label' => 'Open'],
['value' => 'closed', 'label' => 'Closed']
]
]
try {
$orders = $this->apiClient->get('orders');
} catch (\Exception $e) {
Log::error("Failed to fetch orders: " . $e->getMessage());
return ['error' => $e->getMessage()];
}
if ($this->accessToken->expires_at < now()->addMinutes(5)) {
$this->refreshAccessToken();
}

View existing integrations for reference:

  • Shopify V2: app/Classes/ShopifyV2Integration.php
  • Amazon: app/Classes/AmazonIntegration.php
  • WooCommerce: app/Classes/WooCommerceIntegration.php