mollie / mollie-api-node

Official Mollie API client for Node
http://www.mollie.com
BSD 3-Clause "New" or "Revised" License
238 stars 63 forks source link

Error: Response for preflight has invalid HTTP status code 405 #182

Closed mdwt closed 3 years ago

mdwt commented 3 years ago

Hi,

I'm getting this error when trying to create a payment with the API:

Error: Response for preflight has invalid HTTP status code 405.

I'm using the example code as-is with my test API key

Node v12.16.3 "@mollie/api-client": "^3.4.0",

    const mollieClient = createMollieClient({apiKey: 'test_whKhP4Kp2pyGaCMgtQexncbcc4decC'});

    try {
        const payment: Payment = await mollieClient.payments.create({
            amount: {
                currency: 'EUR',
                value: '10.00', 
            },
            description: 'My first payment',
            redirectUrl: 'https://webshop.example.org/order/12345/',
            webhookUrl: 'https://webshop.example.org/payments/webhook/',
            metadata: {
                order_id: '12345',
            },
        });

        console.log(payment);
    } catch (error) {
        console.warn(error);
    }
Pimm commented 3 years ago

Hi Meiring,

This sounds like your traffic might be routed somehow. On what machine are you testing this? Is this your local machine, or a server?