@cthulhu-dev/cthulhupay-react
v0.1.11
Published
<h1 align="center"> <img src="https://github.com/cthulhu-dev/cthulhupay-lib-react/assets/26878256/f0416d9b-03b8-4bd6-af06-cb2dbab9954b" width="36" /> CthulhuPay for react </h1> <p align="center"> <img src="https://github.com/cthulhu-dev/cthulhupay-lib-r
Downloads
24
Readme
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;
}