How the Drupal Commerce PunchOut Integration Works
We built the integration as a round trip:
Basware → Drupal authentication → private PunchOut session → wishlist or project list → OCI mapper → Basware approval
1. Basware starts the session
Basware sends the buyer to a dedicated endpoint in Drupal. The request carries the credentials needed for authentication and a return address, provided as HOOK_URL. That URL is where the completed selection must go.
2. Drupal authenticates the buyer
Drupal validates the credentials against a dedicated account and checks the PunchOut permission. A valid login is not enough: the account must be explicitly allowed to use the integration.
The account is linked to a company profile, so the procurement identifier and the buyer’s organization stay connected to the session.
3. The PunchOut context is stored privately
Drupal creates temporary storage for the current buyer. It keeps the Basware return URL and procurement context available while the buyer moves through the catalog. The data is never shared with another user session.
4. The buyer uses the existing catalog
The catalog behaves as it normally does. The only PunchOut-specific addition is a “Transfer Cart to Procurement System” action, shown while the session is active. Regular marketplace customers do not see it.
5. Drupal prepares the cart
Before loading products, Drupal checks the active session again. A wishlist is loaded for the current user. A project list receives an additional ownership check, so changing an identifier in the request cannot expose another buyer’s data.
The mapper then converts Commerce values to the OCI contract:
| Drupal Commerce value | OCI field |
|---|
| Product description | NEW_ITEM-DESCRIPTION[n] |
| Quantity | NEW_ITEM-QUANTITY[n] |
| Unit | NEW_ITEM-UNIT[n] |
| Unit price | NEW_ITEM-PRICE[n] |
| Supplier SKU | NEW_ITEM-VENDORMAT[n] |
| Currency | NEW_ITEM-CURRENCY[n] |
Prices use the required decimal format, quantities follow one consistent representation, and every item receives its own line index.
6. The cart returns to Basware
The browser submits a hidden OCI form to the stored return URL. Once the transfer starts, Drupal closes the PunchOut session. The buyer lands back in Basware, where the company’s existing approval process continues.