Skip to content

Purchase Orders

Hyvä Checkout Requirements

The Purchase Order checkout integration requires Hyvä Checkout version 1.1.18 or newer as it relies on the updated navigation system introduced in that version. Additionally, the Purchase Order checkout integration also requires Hyva_EnterpriseCheckout version 0.1.1 or newer as it relies on URL parameter functionality introduced in that version.

Online vs Offline Payment Methods

Per Adobe's Purchase Order flow, our checkout integration only affects orders being placed using online payment methods. From a technical perspective, the result of the Magento\Payment\Model\MethodInterface::isOffline() function is used to determine whether a payment method is online or offline.

You can read more about offline vs online payment methods in Adobe's official Purchase Order documentation.

Purchase Order Notice

When the customer opts to pay using an online payment method, the normal payment method content is replaced by a notice informing them that they will need to enter their payment details once their Purchase Order has been approved. This notice is defined as a deliberately "hidden" or "orphaned" block in the hyva_checkout_components.xml layout handle and is dynamically loaded in place of the original payment method block when required. The name of this block is checkout.payment.method.purchase.order.notice and is uses the Hyva_EnterpriseCheckoutB2b::checkout/payment/method/purchase-order.phtml template.

This notice is NOT displayed for offline payment methods.

Order Placement

Once the customer clicks the Place Order button, an around plugin determines whether Magento should process the order normally or as a Purchase Order instead. This plugin can be found in Hyva\EnterpriseCheckoutB2b\Plugin\Hyva\Checkout\Model\Magewire\Payment\PlaceOrderServiceInterface\PlacePurchaseOrderService and is the same plugin that handles both the initial Purchase Order placement and subsequent payment.

If the integration determines that the customer has placed a Purchase Order, they are redirected to the Purchase Order success page - /purchaseorder/purchaseorder/success. Once the customer pays for their Purchase Order, they are redirected per their chosen payment method's implementation.

New Purchase Order Specific Checkout

With a Purchase Order placed and approved, the customer is then able to complete their order by actually paying for it. When they do so, our Purchase Order integration dynamically loads a new, "hidden" checkout specifically for the payment of Purchase Orders. This new checkout is defined in the module's etc/hyva_checkout.xml file under the name ee_default_purchase_order. As you can see from its definition below, it consists of only a single step: payment.

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:module:Hyva_Checkout:etc/hyva_checkout.xsd">
    <checkout name="ee_default_purchase_order"
              label="Hyvä Default Purchase Order"
              layout="2columns">
        <step name="payment"
              label="Review Purchase Order"
              route="payment"/>
    </checkout>
</config>

Purchase Order Checkout

In order to prevent merchants accidentally or unknowingly using this checkout outside the scope of Purchase Order payments, it is not included in the list of available checkouts in the Hyvä checkout admin - hence why we referred to it as "hidden" earlier.

Purchase Order Payment Step

In order to keep things simple and consistent, the Purchase Order payment step is populated using the existing checkout.payment.section container defined in the hyva_checkout_components.xml layout handle. Given that Adobe recommends against allowing customers to apply further discounts during the Purchase Order payment, we have removed those blocks from the default Purchase Order payment step.

The layout handle for the Purchase Order payment step is hyva_checkout_ee_default_purchase_order_payment.xml. See the checkout layout handles documentation for more information.

While on this step, the customer is then able to select their payment method and enter their payment details as normal. As mentioned previously, an around plugin wraps the place order functionality - however, clicking the Place Order button on this step results in Magento processing the quote as an order.