The payment id is invalid - Node Package
See original GitHub issueOk, made some headway now on the server side. However I’m getting the following error: { type: ‘request’, message: ‘The payment id is invalid’ }
I’ve constructed the following setup using the examples:
const express = require('express');
const Mollie = require('mollie-api-node');
const router = express.Router();
const mollie = new Mollie.API.Client();
mollie.setApiKey('test_mytestAPIkey');
router.post('/webhook/:id', (req, res) => {
const id = req.params.id;
console.log('webhook triggered', id);
mollie.payments.get(id, (payment) => {
console.log('payment', payment);
if (payment.error) {
console.error(payment.error);
return res.end();
}
if (payment.isPaid()) {
console.log('paid');
} else if (!payment.isOpen()) {
console.log('abort');
}
return res.end();
});
return res.end();
});
router.get('/', (req, res) => {
const Id = new Date().getTime();
mollie.payments.create({
amount: 10.00,
description: 'My first API payment',
redirectUrl: 'http://'.concat(req.headers.host).concat('/mollie'),
webhookUrl: 'http://'.concat(req.headers.host).concat('/api/mollie/webhook/').concat(Id),
metadata: { orderId: Id },
}, (() => {
return (payment) => {
if (payment.error) {
console.error(payment.error);
return res.end();
}
console.log('http://'.concat(req.headers.host).concat('/api/mollie/webhook/').concat(Id));
res.writeHead(302, {
Location: payment.getPaymentUrl(),
});
return res.end();
};
})(this));
});
module.exports = router;
When I log the read the results in my terminal window after a GET request on mysite.nl/api/mollie, it seems that both the sent ID and the received ID are the same:
http://mysite.nl/api/mollie/webhook/1509674934006
GET /api/mollie 302 80.284 ms - -
webhook triggered 1509674934006
POST /api/mollie/webhook/1509674934006 200 48.966 ms - -
payment { error: { type: 'request', message: 'The payment id is invalid' } }
{ type: 'request', message: 'The payment id is invalid' }
Nonetheless, I’m getting that error. Is this normal to get this error in testmode, or am I doing something wrong?
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
The id provided does not exist razorpay in nodejs
So I faced this issue The id provided does not exist because of the mismatch of Razorpay Keys on the frontend and backend...
Read more >Common errors | npm Docs
Invalid JSON This can be caused by corporate proxies that give HTML responses to package. json requests. Check npm's proxy configuration. Check that...
Read more >Transaction | Node.js - Braintree Developer Documentation
A unique number that tags a credit or debit card transaction when it goes from the merchant's bank through to the cardholder's bank....
Read more >Create a PaymentIntent – Node - Stripe API reference
The ID of a Financial Connections Account to use as a payment method. payment_method_data.us_bank_account.routing_number optional. Routing number of the bank ...
Read more >Razorpay Payment Integration using Node.js - GeeksforGeeks
This will ask you for few configurations about your project you can fill them accordingly, also you can change it later from the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I see you are using the old package using callbacks. Just a heads up: there is a
npm install mollie-api-node@next
package available written in ES6 that allows you to use promises.Ah wait, there’s difference between my ID for my own administration and the ID you send back, right? I just did a console.log(req.body) and I got a randomized string. This must be the right thing.