5.05

Payment & Shipping Methods

Given a scenario, configure payment and shipping methods: offline vs online shipping, TableRate CSV, payment types (offline, gateway, hosted), and payment actions (Authorize, Capture, Order).

Why This Matters: Shipping and payment method configuration is critical for checkout. Understanding offline vs online shipping, TableRate CSV uploads, payment method types (offline, gateway, hosted), and payment actions (Authorize, Capture, Order) ensures correct checkout behavior.

Payment & Shipping Methods

mindmap root((Payment & Shipping)) Shipping Methods Offline (FlatRate, TableRate, Free, In-Store) Online (Carriers with API) TableRate CSV upload Payment Methods Offline (Check, Bank transfer, Cash on delivery, Purchase order) Gateway (Remote API request) Hosted (Redirect to external site) Payment Actions Authorize only Capture Order PayPal Express Checkout Enable In Context option

Shipping Method Configuration

Offline Shipping Methods

Offline methods do not perform online requests when calculating shipping rates. Configuration is done entirely in admin.

  • Flat Rate: Fixed price per order/item.
  • Table Rate: Rates based on conditions (weight, subtotal, destination) from a CSV file.
  • Free Shipping: Configured with conditions (e.g., order total > $100).
  • In-Store Delivery: Customer picks up; no shipping cost.

Typical configuration includes: name, price, handling fees, conditions.

Table Rate CSV Upload

Table Rate requires uploading a CSV file with rate information via admin panel.

  • Download reference CSV from admin.
  • Fill with rates based on conditions (destination, weight, subtotal, item count).
  • Upload via Stores → Configuration → Sales → Shipping Methods → Table Rates.
Tip: Table Rate CSV upload is a great reference for implementing file uploads in system configuration!

Online Shipping Methods (Carriers)

Online methods (carriers) request APIs during checkout to obtain real-time shipping rates.

  • Examples: UPS, FedEx, USPS, DHL.
  • Require credentials (API keys, account numbers).
  • Configuration varies per carrier (e.g., allowed methods, container types, handling fees).

See: Delivery Methods

Payment Method Configuration

There are three types of payment methods in Magento:

  1. Offline: No processing during checkout; payment handled outside Magento.
  2. Gateway: Sends remote API request to payment provider during checkout.
  3. Hosted: Redirects customer to external site for payment, then redirects back.

Offline Payment Methods

Offline methods do nothing during checkout; assume payment occurs externally.

  • Check/Money Order
  • Bank Transfer
  • Zero Subtotal Checkout (for $0 orders)
  • Cash on Delivery
  • Purchase Order

Configuration is straightforward: title, instructions, order status.

See: Payment Methods

Gateway Payment Methods

Gateway methods send remote API requests to payment providers to process payments without leaving the Magento site.

  • Configuration: API credentials, payment action, sandbox mode.
  • Customer enters card details on Magento checkout.
  • Magento sends data to gateway API for processing.
Note: In Magento 2.4, most online methods except PayPal were removed from core. Use extensions for others.

Hosted Payment Methods

Hosted methods redirect customers to an external site for payment, then redirect back after completion.

  • Example: PayPal Express Checkout
  • Customer clicks "Checkout with PayPal" → redirected to PayPal → completes payment → returns to Magento.
  • Configuration: API credentials, payment action, return URLs.

Payment Actions

Payment Action defines what happens when placing a payment. Configured per payment method.

\Magento\Sales\Model\Order\Payment

Three principal options supported by the Payment class:

  1. Authorize only
    • Authorizes funds without charging.
    • Invoice is NOT created.
    • Admin must manually hit "Invoice" button to capture funds.
  2. Capture
    • Charges the card immediately.
    • Invoice is automatically created.
    • No admin action required.
  3. Order
    • Does nothing; invoice is NOT created.
    • Admin must charge card manually when creating invoice.
    • No guarantee funds are available.
Key: Online methods typically use tokens for subsequent operations (authorize → capture → refund).

PayPal Configuration

PayPal Express Checkout

Hosted method that redirects to PayPal for payment.

  • Configuration: API credentials (username, password, signature), sandbox mode, payment action.
  • "Enable In-Context Checkout" option: Improves UX by keeping customer on Magento site (PayPal opens in modal/iframe). Functionally similar but feels seamless.

See: PayPal Express Checkout

Further reading: Other PayPal Methods

Further Reading

Exam Tips

  • Shipping: Offline (no API) vs Online (carriers with API). TableRate requires CSV upload.
  • Payment types: Offline (external), Gateway (API on Magento), Hosted (redirect).
  • Payment Actions:
    • Authorize only: Reserve funds, no invoice, manual capture.
    • Capture: Charge card, auto-invoice.
    • Order: Do nothing, manual invoice/charge.
  • Magento 2.4: Removed most online payment methods except PayPal from core.
  • PayPal: Express = hosted; "Enable In-Context" improves UX without leaving site.