@one-checkout/one-checkout-sdk
v0.0.12
Published
JS- & React-SDK to connect your App to One-Checkout.
Downloads
33
Readme
One-Checkout SDK
Install
npm install --save @one-checkout/one-checkout-sdk
Create Account
Goto https://one-checkout.com and create a new account. Obtain an API key from the merchant backend.
Usage
import React from 'react'
import {
Provider,
BuyButton,
Cart,
useOneCheckoutData,
} from '@one-checkout/one-checkout-sdk'
export default function App() {
return (
<div>
<Provider apiKey="yourApiKey">
<CustomComponent />
<BuyButton productId="productIdFromMerchantBackend">
Buy now
</BuyButton>
<Cart />
</Provider>
</div>
)
}
function CustomComponent() {
const oneCheckoutData = useOneCheckoutData();
return <div>{oneCheckoutData.cart.sumFormatted}</div>;
}
License
UNLICENSED © One-Checkout