This is a TypeScript React library for creating an Apple Pay Button. This library follows the Apple Pay Button JavaScript guidelines. It allows you to easily integrate Apple Pay into your React applications.
Here are some resources to help you understand how this library works:
To install this library, run the following command:
npm install apple-pay-button
Here's a basic example of how to use this library:
import { ApplePayButton } from 'apple-pay-button';
function App() {
const onClick = () => {
// Do something
}
return (
<div className="App">
<ApplePayButton
onClick={onClick}
style={{
width: '100%',
borderRadius: '8px',
}}
type="continue"
/>
</div>
);
}
export default App;
Prop | Type | Description |
---|---|---|
buttonStyle |
'black' | 'white' | 'white-outline' |
The style of the Apple Pay button. Default is 'black' . |
type |
ButtonType |
The type of the Apple Pay button. Default is 'buy' . |
locale |
string |
The locale for the Apple Pay button. Default is 'en-US' . |
onClick |
() => void |
The callback function when the Apple Pay button is clicked. |
style |
{ width?: string; height?: string; borderRadius?: string; padding?: string; boxSizing?: string; } |
The style object for the Apple Pay button. |
disabled |
boolean |
Whether the Apple Pay button is disabled. Default is false . |
Where ButtonType
is one of the following: 'plain'
, 'add-money'
, 'book'
, 'buy'
, 'check-out'
, 'continue'
, 'contribute'
, 'donate'
, 'order'
, 'pay'
, 'reload'
, 'rent'
, 'set-up'
, 'subscribe'
, 'support'
, 'tip'
, 'top-up'
.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
MIT © Johan Corrales