株式会社WR

株式会社WR

WEB TOTAL CONSULTING

Amazon FBA料金の計算ロジック——プログラムで自動計算する方法
ブログ一覧へ
技術ブログ

Amazon FBA料金の計算ロジック——プログラムで自動計算する方法

Amazon FBAで販売する際の収益計算は複雑です。販売手数料・FBA配送代行手数料・在庫保管料をプログラムで自動計算する仕組みを作ります。

Amazon FBA料金体系の複雑さ

Amazonフルフィルメント(FBA)を利用した場合の費用は、単純な「商品価格×手数料率」ではなく、複数の費用が複雑に絡み合っています。

  • 販売手数料:カテゴリ別の成約料(8〜15%が多い)
  • FBA配送代行手数料:サイズ・重量に応じた段階的な料金
  • FBA在庫保管手数料:1日単位で発生、ハイシーズンは割高
  • 長期保管手数料:365日超の在庫に追加課金
  • 返品処理手数料:返品1件ごとに発生

これらをExcelで手動計算するのは限界があり、プログラムによる自動計算が有効です。


カテゴリ別販売手数料

class AmazonFeeCalculator
{
    // カテゴリ別手数料率(2024年版・主要カテゴリ)
    private array $referralRates = [
        'electronics'      => 0.08,  // 家電 8%
        'clothing'         => 0.15,  // 衣料 15%
        'beauty'           => 0.08,  // 美容 8%
        'books'            => 0.15,  // 本 15%
        'toys'             => 0.10,  // おもちゃ 10%
        'sports'           => 0.10,  // スポーツ 10%
        'home'             => 0.10,  // ホーム 10%
        'default'          => 0.10,  // その他 10%
    ];

    // 最低成約料(円)
    private array $minimumReferralFee = [
        'electronics' => 40,
        'default'     => 30,
    ];

    public function getReferralFee(float $price, string $category = 'default'): float
    {
        $rate = $this->referralRates[$category] ?? $this->referralRates['default'];
        $fee = $price * $rate;
        $minFee = $this->minimumReferralFee[$category] ?? $this->minimumReferralFee['default'];

        return max($fee, $minFee);
    }
}

FBA配送代行手数料の計算

手数料はサイズ区分と重量で決まります。

class FbaShippingCalculator
{
    // サイズ区分の定義(cm, kg)
    private array $sizeCategories = [
        'small_standard' => [
            'max_length' => 25, 'max_width' => 18, 'max_height' => 2,
            'max_weight' => 0.25,
        ],
        'standard'       => [
            'max_length' => 45, 'max_width' => 35, 'max_height' => 20,
            'max_weight' => 9.0,
        ],
        'large'          => [
            'max_length' => 100, 'max_width' => 75, 'max_height' => 75,
            'max_weight' => 25.0,
        ],
    ];

    // 配送代行手数料(円)
    private array $baseFees = [
        'small_standard' => 310,
        'standard'       => [
            ['max_weight' => 0.5,  'fee' => 430],
            ['max_weight' => 1.0,  'fee' => 510],
            ['max_weight' => 2.0,  'fee' => 590],
            ['max_weight' => 9.0,  'fee' => 730],
        ],
        'large' => [
            ['max_weight' => 1.0,  'fee' => 820],
            ['max_weight' => 5.0,  'fee' => 1050],
            ['max_weight' => 25.0, 'fee' => 1450],
        ],
    ];

    public function getShippingFee(
        float $length, float $width, float $height, float $weight
    ): float {
        $category = $this->determineSizeCategory($length, $width, $height, $weight);

        if ($category === 'small_standard') {
            return $this->baseFees['small_standard'];
        }

        $tiers = $this->baseFees[$category];
        foreach ($tiers as $tier) {
            if ($weight <= $tier['max_weight']) {
                return $tier['fee'];
            }
        }

        // 超大型の場合は追加計算
        return 2000 + ($weight - 25) * 50;
    }

    private function determineSizeCategory(
        float $l, float $w, float $h, float $weight
    ): string {
        $small = $this->sizeCategories['small_standard'];
        if ($l <= $small['max_length'] && $w <= $small['max_width']
            && $h <= $small['max_height'] && $weight <= $small['max_weight']) {
            return 'small_standard';
        }

        $standard = $this->sizeCategories['standard'];
        if ($l <= $standard['max_length'] && $w <= $standard['max_width']
            && $h <= $standard['max_height'] && $weight <= $standard['max_weight']) {
            return 'standard';
        }

        return 'large';
    }
}

在庫保管手数料の計算

class StorageFeeCalculator
{
    // 月別保管料(1m³・1ヶ月あたり)
    private array $monthlyRates = [
        'jan' => 3600, 'feb' => 3600, 'mar' => 3600,
        'apr' => 3600, 'may' => 3600, 'jun' => 3600,
        'jul' => 3600, 'aug' => 3600, 'sep' => 3600,
        'oct' => 6600, 'nov' => 6600, 'dec' => 6600, // ハイシーズン割高
    ];

    /**
     * 在庫保管手数料を計算
     * @param float $cubicMeters 商品の体積(m³)
     * @param int $days 保管日数
     * @param int $month 保管月(1〜12)
     */
    public function calculateStorageFee(float $cubicMeters, int $days, int $month): float
    {
        $monthKey = strtolower(date('M', mktime(0, 0, 0, $month, 1)));
        $monthlyRate = $this->monthlyRates[$monthKey] ?? 3600;
        $daysInMonth = cal_days_in_month(CAL_GREGORIAN, $month, date('Y'));

        return $cubicMeters * $monthlyRate * ($days / $daysInMonth);
    }
}

総合計算クラス

class AmazonFbaProfit
{
    public function __construct(
        private AmazonFeeCalculator $feeCalc,
        private FbaShippingCalculator $shippingCalc,
        private StorageFeeCalculator $storageCalc,
    ) {}

    public function calculate(array $product): array
    {
        $sellingPrice  = $product['selling_price'];
        $purchasePrice = $product['purchase_price'];
        $category      = $product['category'];

        // 各種手数料
        $referralFee   = $this->feeCalc->getReferralFee($sellingPrice, $category);
        $shippingFee   = $this->shippingCalc->getShippingFee(
            $product['length'], $product['width'],
            $product['height'], $product['weight']
        );
        $storageFee    = $this->storageCalc->calculateStorageFee(
            ($product['length'] * $product['width'] * $product['height']) / 1_000_000,
            $product['storage_days'] ?? 30,
            (int) date('n')
        );

        $totalFees = $referralFee + $shippingFee + $storageFee;
        $profit    = $sellingPrice - $purchasePrice - $totalFees;
        $margin    = $sellingPrice > 0 ? $profit / $sellingPrice * 100 : 0;

        return [
            'selling_price'  => $sellingPrice,
            'purchase_price' => $purchasePrice,
            'referral_fee'   => round($referralFee),
            'shipping_fee'   => round($shippingFee),
            'storage_fee'    => round($storageFee),
            'total_fees'     => round($totalFees),
            'profit'         => round($profit),
            'margin_pct'     => round($margin, 1),
        ];
    }
}

Laravelでバッチ処理する

// 複数商品を一括で利益計算
$calculator = app(AmazonFbaProfit::class);
$products = Product::where('active', true)->get();

$results = $products->map(function ($product) use ($calculator) {
    return $calculator->calculate($product->toArray());
});

// 利益率10%以上の商品だけフィルタ
$profitable = $results->filter(fn($r) => $r['margin_pct'] >= 10);

まとめ

Amazon FBAの料金計算は複数の変数が絡み合っており、正確な利益計算にはプログラムが欠かせません。弊社では仕入れ判断ツール・在庫管理システムへのFBA料金計算組み込みを実装した実績があります。

ECビジネスの自動化・システム化についてはお気軽にご相談ください。

Category 技術ブログ

Related Posts

関連記事

開発・技術のご相談はお気軽に

お見積りは無料です。まずはお気軽にご相談ください。

お問い合わせ →