I'm working on a Node.js application that integrates with the Mollie payment gateway. I'm facing an issue where I receive the error "The payment method is not enabled in your website profile" when trying to create a payment with a dynamic price using the Mollie API. However, when I switch to using a static price, everything works fine. In my application, users can input a price value, and I pass this value to the Mollie API when creating a payment. Here's an example of the code:
// Relevant code snippet
// ...
app.post('/create-payment', async (req, res) => {
try {
const price = req.body.price; // Dynamic price value from user input
const mollieClient = await createMollieClient({ apiKey: 'My_API' });
const payment = await mollieClient.payments.create({
amount: {
currency: 'EUR',
value: price,
},
// Other payment details
// ...
});
res.json({ url: payment.getCheckoutUrl() });
} catch (error) {
console.error('Error creating Mollie payment:', error);
res.status(500).send('Error creating payment');
}
});
// ...
When I test the application with a static price value, the payment creation is successful. However, when I switch to using a dynamic price value obtained from user input, I receive the "The payment method is not enabled in your website profile" error.
I have verified that the Mollie website profile has all the necessary payment methods enabled, and the API key has the required permissions. Additionally, I have confirmed that the dynamic price value is correctly received and passed to the Mollie API.
I'm unsure why the error occurs only with dynamic prices and not with static prices. Is there anything specific I need to consider when using dynamic values for the payment amount in Mollie?
You need to edit your price in correct format:
This is my node js example for mollie with mongoDB flow