Skip to content

Payment Flow

Standard checkout (credit card / iDEAL)

sequenceDiagram
    participant Customer
    participant WooCommerce
    participant Gateway
    participant Adyen API

    Customer->>WooCommerce: Place order (checkout submit)
    WooCommerce->>Gateway: process_payment($order_id)
    Gateway->>Adyen API: POST /v68/payments (via Checkout service)
    Adyen API-->>Gateway: { resultCode, pspReference, ... }
    alt Authorised
        Gateway->>WooCommerce: Mark order "on-hold" / "processing"
        Gateway-->>Customer: Redirect to thank-you page
    else Refused / Error
        Gateway-->>Customer: Show error, order stays pending
    end
    Note over Adyen API,Gateway: Adyen sends async webhook (see notifications.md)

The use_hpp flag on Gateway\IDEAL causes the gateway to create a payment link on Adyen's hosted payment page and redirect the customer there, rather than processing inline.

Subscription renewal

Triggered by WooCommerce Subscriptions on the renewal date.

sequenceDiagram
    participant Action Scheduler
    participant SubscriptionsManager
    participant CreditCard Gateway
    participant Adyen API

    Action Scheduler->>SubscriptionsManager: woocommerce_scheduled_subscription_payment_adyen_creditcard
    SubscriptionsManager->>CreditCard Gateway: process_recurring_payment($renewal_order)
    CreditCard Gateway->>Adyen API: POST /v68/payments (ContAuth, recurringDetailReference)
    Adyen API-->>CreditCard Gateway: { resultCode: "Authorised", pspReference }
    CreditCard Gateway->>WooCommerce: Set PSP reference, add order note
    alt Not Authorised
        CreditCard Gateway--xSubscriptionsManager: throw FailedRecurringPaymentRequestException
        SubscriptionsManager->>WooCommerce: Mark renewal order as failed
    end

The stored recurringDetailReference is retrieved from the parent subscription via woocommerce_adyen_get_recurring_detail_reference(). The shopperInteraction is set to ContAuth (Continuous Authority) to indicate a merchant-initiated transaction.

Change payment method

Handled by Modules\ChangePaymentMethod. When a subscriber changes their payment method, the next renewal uses the newly tokenised recurringDetailReference.