Checkout and payments

Even if your Stripe integration doesn't utilize Stripe Billing products, you can still make use of the A-Cube e-invoicing Stripe app. This can be done by supplying some metadata during the creation of the checkout session.

The metadata information should be linked to the PaymentIntent. Here's a breakdown of the fields:
Metadata FieldDescriptionRequired
currencyThe currency used in the invoice (e.g., EUR)Yes
numberThe invoice number. If not provided, an autoincrement number will be usedNo
customer_nameThe name of the customerYes
customer_address_cityThe city where the customer residesYes
customer_address_line1The customer's addressYes
customer_address_postal_codeThe postal code of the customer's location (5 characters)Yes
customer_address_countryThe country of the customer (2 characters)Yes
customer_address_stateThe state or region of the customerYes
customer_tax_idThe VAT number of the customer (for B2B transactions)No
customer_fiscal_codeThe fiscal identifier of the customer (for B2C transactions)No
customer_codice_destinatarioThe recipient code of the customerNo
line_<n>_descriptionThe description of the <n> line itemYes
line_<n>_unitpriceThe unit price of the <n> line item in centsYes
line_<n>_quantityThe quantity of the <n> line itemNo
line_<n>_vatrateThe VAT rate of the <n> line item. The calculated tax amount will be added to the unit priceYes
Note: Either customer_tax_id or customer_fiscal_code must be provided.

Note: <n> must be an integer starting from 1


Here's an example of how to create a checkout session with metadata:

Copy
Copied
stripe checkout sessions create  \
--mode=payment \
--success-url="https://acubeapi.com" \
--cancel-url="https://acubeapi.com" \
-d "line_items[0][price]"="your first Stripe product identifier here" \
-d "line_items[0][quantity]"=5 \
-d "line_items[1][price]"="your second Stripe product identifier here" \
-d "line_items[1][quantity]"=10 \
-d "payment_intent_data[metadata][currency]"="eur" \
-d "payment_intent_data[metadata][customer_name]"="my customer" \
-d "payment_intent_data[metadata][customer_address_city]"="Milan" \
-d "payment_intent_data[metadata][customer_address_line1]"="street a" \
-d "payment_intent_data[metadata][customer_address_postal_code]"="12345" \
-d "payment_intent_data[metadata][customer_address_country]"="IT" \
-d "payment_intent_data[metadata][customer_address_state]"="MI" \
-d "payment_intent_data[metadata][customer_tax_id]"="12345678901" \
-d "payment_intent_data[metadata][line_1_description]"="fresh eggs!" \
-d "payment_intent_data[metadata][line_1_unitprice]"="100" \  # 1.00 EUR
-d "payment_intent_data[metadata][line_1_quantity]"="5" \
-d "payment_intent_data[metadata][line_1_vatrate]"="4" \  # 4% VAT rate -> 0.04 EUR
-d "payment_intent_data[metadata][line_2_description]"="tomato" \
-d "payment_intent_data[metadata][line_2_unitprice]"="50" \  # 0.50 EUR
-d "payment_intent_data[metadata][line_2_quantity]"="10" \
-d "payment_intent_data[metadata][line_2_vatrate]"="10"  # 10% VAT rate -> 0.05 EUR