0.1.11 • Published 1 year ago
@cthulhu-dev/cthulhupay-react v0.1.11
Install
npm install @cthulhu-dev/cthulhupay-react
Use
import CthulhuPay from '@cthulhu-dev/cthulhupay-react';
import {CthulhuPayRequest, CthulhuPayResponse} from '@cthulhu-dev/cthulhupay-react';
export function Checkout({request}: {request: CthulhuPayRequest}) {
return <CthulhuPay
apiUrl="https://path-to-api/method"
requestInterceptor={requestInterceptor}
height={780}
request={request}
onDone={(response: CthulhuPayResponse) => console.log(response)}
onError={(error: Error) => console.error(error)}
onLoad={() => console.log('iframe is loaded')} />;
}
async function requestInterceptor(request: Request) {
// add what you need to request header
// example:
// request.headers.set('Accept-Language', 'he-IL');
return request;
}