Skip to main content

Handling Invoices

Introduction​

Simpler Checkout allows business customers (B2B) to request an invoice by providing their company details, such as their tax ID and company address, directly within the checkout flow.

When this feature is enabled, the Submit Order Request sent to your Platform Interface will contain an additional invoice object. This tutorial covers how to process that data and how to get the feature activated for your store.

Step 1: Activation​

The Invoicing capability is not enabled by default. To start receiving invoice data:

  1. Ensure your Platform Interface is ready to parse the invoice object (see Step 2).
  2. Contact Simpler Support to enable the invoicing capability.

Step 2: Update the Order Submission Logic​

When a shopper requests an invoice, the submit request will include the invoice property at the root of the request, next to order and user. You must map this to your internal accounting or ERP system.

The invoice object contains:

  • tax_id — the company's Tax Identification Number
  • company_name — the official company name
  • activity — the company's business activity
  • tax_authority — the tax authority that issued the tax ID
  • company_address — the company address, as a single string

Implementation Example (PHP)​

src/Controller/Simpler/SubmitController.php
class SimplerSubmitController extends AbstractController {
public function postData(Request $request): Response {
$requestData = json_decode($request->getContent(), true);

// 1. Initialize your order/cart as usual
$cart = CartService::createCart();
// ... (add items and shipping as shown in Basic Flow)

// 2. Check if an invoice was requested
if (!empty($requestData['invoice'])) {
$invoiceDetails = $requestData['invoice'];

// Map Simpler invoice data to your system
$cart->setInvoiceRequested(true);
$cart->setTaxId($invoiceDetails['tax_id']);
$cart->setCompanyName($invoiceDetails['company_name']);
$cart->setCompanyActivity($invoiceDetails['activity']);
$cart->setTaxAuthority($invoiceDetails['tax_authority']);
$cart->setCompanyAddress($invoiceDetails['company_address']);
}

$order = CheckoutService::createOrder(
$cart,
$requestData['user'],
$requestData['order']['ship_to'] ?? null,
$requestData['order']['simpler_id']
);

return $this->json([
'request_id' => $requestData['request_id'],
'order_id' => $order->getID()
]);
}
}