signoz/frontend/src/api/billing/checkout.ts
Yunus M 5b858f2963
Billing UI (#3711)
* feat: integrate billing api and wire up billing ui

* feat: show billing to admin only if on plans other than basic plan

* feat: show billing to admin only if on plans other than basic plan

* feat: update notfound snapshot

* chore: fix billing sidenav logic

* chore: fix several bugs

* chore: backend fix for billing

* fix: window.open pop blocker issue and error ui (#3750)

---------

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
Co-authored-by: Rajat Dabade <rajat@signoz.io>
2023-10-16 23:57:44 +05:30

32 lines
846 B
TypeScript

import axios from 'api';
import { ErrorResponseHandler } from 'api/ErrorResponseHandler';
import { AxiosError } from 'axios';
import { ErrorResponse, SuccessResponse } from 'types/api';
import {
CheckoutRequestPayloadProps,
CheckoutSuccessPayloadProps,
} from 'types/api/billing/checkout';
const updateCreditCardApi = async (
props: CheckoutRequestPayloadProps,
): Promise<SuccessResponse<CheckoutSuccessPayloadProps> | ErrorResponse> => {
try {
const response = await axios.post('/checkout', {
licenseKey: props.licenseKey,
successURL: props.successURL,
cancelURL: props.cancelURL, // temp
});
return {
statusCode: 200,
error: null,
message: response.data.status,
payload: response.data.data,
};
} catch (error) {
return ErrorResponseHandler(error as AxiosError);
}
};
export default updateCreditCardApi;