#An unknown error occurred on medusa.carts.complete

16 messages · Page 1 of 1 (latest)

tall shale
#

Hello! I'm still a beginner there. I'm trying to complete an order with the following code:

const { cart } = await medusa.carts.createPaymentSessions(medusaCartId)
await medusa.carts.setPaymentSession(medusaCartId, {
        provider_id: cart.payment_sessions[0].provider_id, // manual
      })
const { type, data } = await medusa.carts.complete(medusaCartId);

But the last line throws an error (from the attached screenshot). Any thoughts how to fix that? Thank you!

#

When I do carts.complete again I get

indigo wind
#

What about the payment provider? What are you using?

tall shale
#

@indigo wind it's "manual"

indigo wind
#

Did you complete the cart the very first time? Because the message says payment with cart id ... already exists

tall shale
#

Did you complete the cart the very first time?
@indigo wind On first call it says "An unknown error occurred" on the second call it says "Payment with..."

indigo wind
#

Is this the log from the medusa server?

tall shale
#

@indigo wind yes. It's an axios response

unreal harness
#

You need to show errors on backend console. Not responses from axios

indigo wind
#

^ this

tall shale
unreal harness
#

I would guess you don't have email set in cart

#

At least I think it creates a customer when email is filled

indigo wind
#

Thats also what I am thinking, seems like customer_id isnt set