How to call Razorpay API methods
masterAll API resources are accessed through the instance using a namespaced signature: {razorpayInstance}.{resourceName}.{methodName}(resourceId [, params]).
Every resource method returns a Promise by default. If you prefer Error-First Callbacks, you can pass a callback function as the last parameter to the method.
// Promise-based usage
instance.payments
.all({
from: '2016-08-01',
to: '2016-08-20',
})
.then(response => {
// handle success
})
.catch(error => {
// handle error
});
// Callback-based usage (Error-First Callback)
instance.payments.all(
{
from: '2016-08-01',
to: '2016-08-20',
},
(error, response) => {
if (error) {
// handle error
} else {
// handle success
}
}
);