umbraco / Umbraco.Commerce.Issues

17 stars 2 forks source link

Order marked as error when callback from stripe, if the product is a subscription #549

Closed marvingbh closed 3 months ago

marvingbh commented 3 months ago

Describe the bug A clear and concise description of what the bug is.

Steps To Reproduce Steps to reproduce the behavior:

  1. Go to https://github.com/umbraco/Umbraco.Headless.Demo
  2. install front and backend
  3. setup UMBRACOCOMMERCECHECKOUT_MODE to Redirect
  4. setup a product as subscription following this https://docs.umbraco.com/umbraco-commerce-payment-providers/stripe/how-to-guides/processing-subscription-payments
  5. Try to purchase the subscription product
  6. everything goes well, but the order is registred as error on callback from stripe

Expected behavior Register the order without error and redirect to /confirmation

Screenshots umbraco: image

stripe image

stripe checkout session completed webhook: image

{ "object": { "id": "cs_test_a1AFZQLcpsC6PoJM1A2mvJSSJueaVIjQOZ7VJgz5e0obxzW6CLsN4MsKBk", "object": "checkout.session", "after_expiration": null, "allow_promotion_codes": null, "amount_subtotal": 1995, "amount_total": 1995, "automatic_tax": { "enabled": false, "liability": null, "status": null }, "billing_address_collection": null, "cancel_url": "https://if-dev-ca-portal-cms-api.lemongrass-4abb7da6.westeurope.azurecontainerapps.io/umbraco/commerce/payment/cancel/stripe-checkout/fd0af56d-416b-40f0-b00e-01913144c463/ORDER-01681-33318-NYLFW/322e47924b0d834940d3a041d2327cbfe3a23fc9", "client_reference_id": "umb://order/fd0af56d-416b-40f0-b00e-01913144c463/ORDER-01681-33318-NYLFW", "client_secret": null, "consent": null, "consent_collection": null, "created": 1723108519, "currency": "usd", "currency_conversion": null, "custom_fields": [], "custom_text": { "after_submit": null, "shipping_address": null, "submit": null, "terms_of_service_acceptance": null }, "customer": "cus_Qchq9LjZHyZdbx", "customer_creation": null, "customer_details": { "address": { "city": "bh", "country": "AQ", "line1": "rua", "line2": null, "postal_code": "1234", "state": "" }, "email": "jon@snow.com", "name": "Jonh Snow", "phone": null, "tax_exempt": "none", "tax_ids": [] }, "customer_email": null, "expires_at": 1723194919, "invoice": "in_1PlSRoDxC6KhVEaiEwaH6B5y", "invoice_creation": null, "livemode": false, "locale": "en", "metadata": {}, "mode": "subscription", "payment_intent": null, "payment_link": null, "payment_method_collection": "always", "payment_method_configuration_details": null, "payment_method_options": { "card": { "request_three_d_secure": "automatic" } }, "payment_method_types": [ "card" ], "payment_status": "paid", "phone_number_collection": { "enabled": false }, "recovered_from": null, "saved_payment_method_options": { "allow_redisplay_filters": [ "always" ], "payment_method_remove": null, "payment_method_save": null }, "setup_intent": null, "shipping_address_collection": null, "shipping_cost": null, "shipping_details": null, "shipping_options": [], "status": "complete", "submit_type": null, "subscription": "sub_1PlSRoDxC6KhVEai78qi8kf6", "success_url": "https://if-dev-ca-portal-cms-api.lemongrass-4abb7da6.westeurope.azurecontainerapps.io/umbraco/commerce/payment/continue/stripe-checkout/fd0af56d-416b-40f0-b00e-01913144c463/ORDER-01681-33318-NYLFW/dba1e57215fac3f97abc12d40de58a04c1f6c425", "total_details": { "amount_discount": 0, "amount_shipping": 0, "amount_tax": 0 }, "ui_mode": "hosted", "url": null }, "previous_attributes": null } Additional context Using Umbraco 13.1, trying to do a headless checkout workflow with Hosted option (just redirect to payment), following the documentation to create a subscription product and it not works. For a non subscription product it works fine. The payment went trough as you can see in the image, everything looks good on stripe, is just the call back that is registring as error, did not found anything in the logs.

Umbraco Commerce version: Umbraco.Commerce 13.1.6 Umbraco.Commerce.PaymentProviders.Stripe 13.1.0 Umbraco.Cms 13.4.1

mattbrailsford commented 3 months ago

Why is your order amount 2000 but your transaction amount is 19.95?

Generally an order will go into an error state if the payment provider reports an error, or the amount paid is under what the order is expecting.

marvingbh commented 3 months ago

Exactly this, the price was mismatch between umbraco and stripe, fixing it works fine. Thank you very much.

mattbrailsford commented 3 months ago

Excellent! Glad you go it working 👍