pcp-server-nodejs-sdk
Version:
[](https://sonarcloud.io/summary/new_code?id=PAYONE-GmbH_PCP-server-nodeJS-SDK) [ {
super(config);
}
async createPaymentIntent(merchantId, payload) {
if (!merchantId) {
throw new TypeError(MERCHANT_ID_REQUIRED_ERROR);
}
const url = new URL(`/v1/${merchantId}/payment-intents`, this.getConfig().getHost());
const requestInit = {
method: 'POST',
headers: new Headers({
'Content-Type': 'application/json',
}),
body: JSON.stringify(payload),
};
return this.makeApiCall(url.toString(), requestInit);
}
async getPaymentIntent(merchantId, paymentIntentId) {
if (!merchantId) {
throw new TypeError(MERCHANT_ID_REQUIRED_ERROR);
}
if (!paymentIntentId) {
throw new TypeError(PAYMENT_INTENT_ID_REQUIRED_ERROR);
}
const url = new URL(`/v1/${merchantId}/payment-intents/${paymentIntentId}`, this.getConfig().getHost());
const requestInit = {
method: 'GET',
headers: new Headers(),
};
return this.makeApiCall(url.toString(), requestInit);
}
}
//# sourceMappingURL=PaymentIntentApiClient.js.map