expresscheckout-nodejs
Version:
Juspay's official expresscheckout-nodejs sdk
66 lines • 3.11 kB
JavaScript
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
import JuspayResource from '../JuspayResource.js';
var Payments = /** @class */ (function (_super) {
__extends(Payments, _super);
function Payments(juspayEnvironment) {
return _super.call(this, juspayEnvironment) || this;
}
/**
* initiate payment for the order id, for merchants
* @param body order_id
* @param juspayConfig override config using this params usage:- {apiKey: '', merchantId: '', ...}
* @returns Promise Response Object
*
* @note
* If you are a PCI compliant merchant, you can combine Create Order API request with Payments API request in a single API request.
* Add order details as below:-
* @example 'order.order_id', 'order.amount'
*
* @link
* - card:- https://docs.juspay.in/api-reference/docs/express-checkout/credit--debit-card-transaction
* - netbanking:- https://docs.juspay.in/api-reference/docs/express-checkout/netbanking-payment
* - wallet:- https://docs.juspay.in/api-reference/docs/express-checkout/wallet-payment
* - wallet direct debit:- https://docs.juspay.in/api-reference/docs/express-checkout/wallet-direct-debit
* - upi collect:- https://docs.juspay.in/api-reference/docs/express-checkout/upi-collect-payment
* - upi intent:- https://docs.juspay.in/api-reference/docs/express-checkout/upi-intent-payment
* - consumer finance:- https://docs.juspay.in/api-reference/docs/express-checkout/consumer-finance-payment
*/
Payments.prototype.create = function (body, juspayConfig) {
body = __assign(__assign({}, body), { merchant_id: this.juspayEnvironment.getMerchantId(), format: 'json' });
return this.makeServiceCall({
method: 'POST',
path: '/txns',
body: body,
juspayOverrideConfig: juspayConfig,
auth: ['JWE']
});
};
return Payments;
}(JuspayResource));
export default Payments;
//# sourceMappingURL=Payments.js.map