Closed 420coupe closed 2 months ago
Ok figured the issue out, it's related to the shipping. If costs anything under $1, it tries to add tax percentage to total.
Example had shipping set to $0.01, and it kept adding 7% (the tax rate i have set for the region), which is ..0007 which you see as the value being added to the amount. Changed shipping amount to $1 and was able to checkout successfully.
I'd assume this would be similarly related to previous issue regarding shipping costs not being able to be 0.
Thanks for the report. We'll look into this asap and get it patched :)
Bug report
Stripe checkout failure - initiatePaymentSession sending incorrect amount.
Describe the bug
When attempting to checkout using nextjs-starter template, the amount being sent to stripe is incorrectly being sent. They only accept integers and there is a decimal value being sent (see screenshot below). The value that is being incorrectly added to the total is the shipping_tax amount. I cannot pin point where in the code these are all added together.
System information
Medusa version (including plugins): all of package.json is 'preview' exact version:
@medusajs/medusa@npm:1.20.6-preview-20240815030523 (via preview)
frontend:@medusajs/js-sdk@0.0.2-preview-20240817150429
Node.js version: v21.7.1 Database: Supabase (postgres) Operating system: Ubuntu 22.04.4 Browser (if relevant):Steps to reproduce the behavior
Expected behavior
Checkout should initiate payment session, then allow user to select payment method and input details and complete checkout.
Screenshots
Code snippets
payload being sent to /v1/payment_intents
[ { "id": "cart_01J5GVYG9MV6349PNSNGEVMPN5", "currency_code": "usd", "email": "420coupe@gmail.com", "created_at": "2024-08-17T19:10:09.717Z", "updated_at": "2024-08-17T19:10:36.374Z", "total": 53.5107, "subtotal": 50.01, "tax_total": 3.5007, "discount_total": 0, "discount_tax_total": 0, "original_total": 53.5114, "original_tax_total": 3.5007, "item_total": 53.5, "item_subtotal": 50, "item_tax_total": 3.5, "original_item_total": 53.5, "original_item_subtotal": 50, "original_item_tax_total": 3.5, "shipping_total": 0.0107, "shipping_subtotal": 0.01, "shipping_tax_total": 0.0007, "original_shipping_tax_total": 0.0007, "original_shipping_subtotal": 0.01, "original_shipping_total": 0.0107, "sales_channel_id": "sc_01J4VWQ8M0HWZ9TWP6SNWKJSA0", "customer_id": "cus_01J5ECMHFCMQTD1VA2029QBND1", "region_id": "reg_01J4WE7JHSS32T9WKDWHPF1YKY", "items": [ { "id": "cali_01J5GVYKHBMVCPYGMT54FYBJXA", "variant_id": "variant_01J5BXGHZTE24ZCV36G68H3R1D", "product_id": "prod_01J5BXGHGV7SW8FFE5PK7B7WN0", "product_title": "Test 1 - CYB", "product_description": "Digital Product Test", "product_subtitle": null, "product_type": null, "product_collection": null, "product_handle": "test-1-cyb", "variant_sku": null, "variant_barcode": null, "variant_title": "Test 1 - CYB", "metadata": {}, "created_at": "2024-08-17T19:10:13.037Z", "updated_at": "2024-08-17T19:10:21.768Z", "title": "Test 1 - CYB", "quantity": 10, "unit_price": 5, "is_tax_inclusive": false, "tax_lines": [ { "id": "calitxl_01J5GVYMSGNK6DCFEAJ47Y6A5A", "description": "Sales Tax", "code": "", "rate": 7, "provider_id": "system" } ], "adjustments": [], "product": { "collection_id": null, "type_id": null, "id": "prod_01J5BXGHGV7SW8FFE5PK7B7WN0", "categories": [], "tags": [] }, "variant": { "id": "variant_01J5BXGHZTE24ZCV36G68H3R1D", "title": "Test 1 - CYB", "sku": null, "barcode": null, "ean": null, "upc": null, "allow_backorder": false, "manage_inventory": false, "hs_code": null, "origin_country": "us", "mid_code": null, "material": null, "weight": null, "length": null, "height": null, "width": null, "metadata": null, "variant_rank": 0, "product_id": "prod_01J5BXGHGV7SW8FFE5PK7B7WN0", "created_at": "2024-08-15T21:01:17.693Z", "updated_at": "2024-08-15T21:01:17.694Z", "deleted_at": null, "options": [ { "id": "optval_01J5BXGHP4G41D4XY599GGXVA7", "value": "default", "option_id": "opt_01J5BXGHKPXRDRFEVGAFKZ0HXR", "option": { "id": "opt_01J5BXGHKPXRDRFEVGAFKZ0HXR", "title": "Default", "product_id": "prod_01J5BXGHGV7SW8FFE5PK7B7WN0", "product": { "id": "prod_01J5BXGHGV7SW8FFE5PK7B7WN0", "title": "Test 1 - CYB", "handle": "test-1-cyb", "subtitle": null, "description": "Digital Product Test", "is_giftcard": false, "thumbnail": "", "weight": null, "length": null, "height": null, "width": null, "origin_country": null, "hs_code": null, "mid_code": null, "material": null, "collection_id": null, "collection": null, "type_id": null, "discountable": true, "created_at": "2024-08-15T21:01:17.147Z", "updated_at": "2024-08-15T21:01:17.147Z", "type": null, "tags": [], "images": [ { "id": "img_01J5BZEDJPWP6CZ4TDG5YWBTTJ", "url": "http://localhost:9000/static/1723757704489-checkYourBallz.png", "metadata": null, "created_at": "2024-08-15T21:35:04.670Z", "updated_at": "2024-08-15T21:35:04.670Z", "deleted_at": null } ] }, "metadata": null, "created_at": "2024-08-15T21:01:17.147Z", "updated_at": "2024-08-15T21:01:17.147Z", "deleted_at": null }, "metadata": null, "created_at": "2024-08-15T21:01:17.147Z", "updated_at": "2024-08-15T21:01:17.147Z", "deleted_at": null } ], "calculated_price": { "id": "pset_01J5BXGJRJVD4DNY8YRKZMCA3J", "is_calculated_price_price_list": false, "is_calculated_price_tax_inclusive": false, "calculated_amount": 5, "raw_calculated_amount": { "value": "5", "precision": 20 }, "is_original_price_price_list": false, "is_original_price_tax_inclusive": false, "original_amount": 5, "raw_original_amount": { "value": "5", "precision": 20 }, "currency_code": "usd", "calculated_price": { "id": "price_01J5BYBCFJASM9RZDXK2TQDZ8M", "price_list_id": null, "price_list_type": null, "min_quantity": null, "max_quantity": null }, "original_price": { "id": "price_01J5BYBCFJASM9RZDXK2TQDZ8M", "price_list_id": null, "price_list_type": null, "min_quantity": null, "max_quantity": null } }, "digital_product": { "id": "01J5BXGK45YXVPYWTMWYFANE08", "name": "test", "created_at": "2024-08-15T21:01:18.854Z", "updated_at": "2024-08-15T21:01:18.854Z", "deleted_at": null }, "product": { "id": "prod_01J5BXGHGV7SW8FFE5PK7B7WN0", "title": "Test 1 - CYB", "subtitle": null, "description": "Digital Product Test", "handle": "test-1-cyb", "is_giftcard": false, "discountable": true, "thumbnail": "", "collection_id": null, "type_id": null, "weight": null, "length": null, "height": null, "width": null, "hs_code": null, "origin_country": null, "mid_code": null, "material": null, "created_at": "2024-08-15T21:01:17.147Z", "updated_at": "2024-08-15T21:01:17.147Z", "type": null, "collection": null, "options": [ { "id": "opt_01J5BXGHKPXRDRFEVGAFKZ0HXR", "title": "Default", "product_id": "prod_01J5BXGHGV7SW8FFE5PK7B7WN0", "metadata": null, "created_at": "2024-08-15T21:01:17.147Z", "updated_at": "2024-08-15T21:01:17.147Z", "deleted_at": null, "values": [ { "id": "optval_01J5BXGHP4G41D4XY599GGXVA7", "value": "default", "option_id": "opt_01J5BXGHKPXRDRFEVGAFKZ0HXR", "metadata": null, "created_at": "2024-08-15T21:01:17.147Z", "updated_at": "2024-08-15T21:01:17.147Z", "deleted_at": null } ] } ], "tags": [], "images": [ { "id": "img_01J5BZEDJPWP6CZ4TDG5YWBTTJ", "url": "http://localhost:9000/static/1723757704489-checkYourBallz.png", "metadata": null, "created_at": "2024-08-15T21:35:04.670Z", "updated_at": "2024-08-15T21:35:04.670Z", "deleted_at": null } ] } } } ], "shipping_methods": [ { "amount": 0.01, "is_tax_inclusive": false, "shipping_option_id": "so_01J5BSXYZ03TZY4NR98XSW8P25", "id": "casm_01J5GVZHZ2ARG47B1ETA3XSCTM", "tax_lines": [ { "id": "casmtxl_01J5GVZJVPMT59VDHNKKPBJW1F", "description": "Sales Tax", "code": "", "rate": 7, "provider_id": "system" } ], "adjustments": [] } ], "shipping_address": { "id": "caaddr_01J5GVZAAMMSSTS0GEJYFJDPY1", "first_name": "Test", "last_name": "User", "company": "", "address_1": "123 Fake Street", "address_2": "", "city": "Miami", "postal_code": "33342", "country_code": "us", "province": "FL", "phone": "3055555555" }, "billing_address": { "id": "caaddr_01J5GVZAAMQR11HZF9EV4F6E3N", "first_name": "Test", "last_name": "User", "company": "", "address_1": "123 Fake Street", "address_2": "", "city": "Miami", "postal_code": "33342", "country_code": "us", "province": "FL", "phone": "3055555555" }, "customer": { "id": "cus_01J5ECMHFCMQTD1VA2029QBND1", "email": "420coupe@gmail.com", "groups": [] }, "region": { "id": "reg_01J4WE7JHSS32T9WKDWHPF1YKY", "name": "North America", "currency_code": "usd", "automatic_taxes": true, "countries": [ { "iso_2": "ca", "iso_3": "can", "num_code": "124", "name": "CANADA", "display_name": "Canada", "region_id": "reg_01J4WE7JHSS32T9WKDWHPF1YKY", "metadata": null, "created_at": "2024-08-09T15:39:34.523Z", "updated_at": "2024-08-09T20:45:38.356Z", "deleted_at": null }, { "iso_2": "us", "iso_3": "usa", "num_code": "840", "name": "UNITED STATES", "display_name": "United States", "region_id": "reg_01J4WE7JHSS32T9WKDWHPF1YKY", "metadata": null, "created_at": "2024-08-09T15:39:34.529Z", "updated_at": "2024-08-09T20:45:38.357Z", "deleted_at": null } ] }, "promotions": [] }, { "provider_id": "pp_stripe_stripe" } ]