I am trying to integrate a third party payment gateway and have to use wrapAsync to wait for the response before redirecting customers to their external page. For some reason the correct response gets caught as an error.
The code below is only executed on the server. And the result will be that I get the payment in the catch statement. So console output:
–> ‘error’
–> payment object
If I do not use try / catch I get a 500 Internal error of undefined
var convertCreatePaymentsToSync = Meteor.wrapAsync( mollie.payments.create, mollie.payments );
try {
var result = convertCreatePaymentsToSync({
amount: 10.00,
description: "My first API payment",
redirectUrl: "someurl"
});
console.log('success');
return result;
} catch (err) {
console.log('error');
return err;
}
Am I missing something obvious here?
Thank for your help