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 thePaymentIntent
. Here's a breakdown of the fields:Metadata Field | Description | Required |
---|---|---|
currency | The currency used in the invoice (e.g., EUR) | Yes |
number | The invoice number. If not provided, an autoincrement number will be used | No |
customer_name | The name of the customer | Yes |
customer_address_city | The city where the customer resides | Yes |
customer_address_line1 | The customer's address | Yes |
customer_address_postal_code | The postal code of the customer's location (5 characters) | Yes |
customer_address_country | The country of the customer (2 characters) | Yes |
customer_address_state | The state or region of the customer | Yes |
customer_tax_id | The VAT number of the customer (for B2B transactions) | No |
customer_fiscal_code | The fiscal identifier of the customer (for B2C transactions) | No |
customer_codice_destinatario | The recipient code of the customer | No |
line_<n>_description | The description of the <n> line item | Yes |
line_<n>_unitprice | The unit price of the <n> line item in cents | Yes |
line_<n>_quantity | The quantity of the <n> line item | No |
line_<n>_vatrate | The VAT rate of the <n> line item. The calculated tax amount will be added to the unit price | Yes |
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:
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