
Research
/Security News
npm Author Qix Compromised via Phishing Email in Major Supply Chain Attack
npm author Qix’s account was compromised, with malicious versions of popular packages like chalk-template, color-convert, and strip-ansi published.
@rebilly/framepay-react
Advanced tools
A React wrapper for Rebilly's FramePay offering out-of-the-box support for Redux and other common React features
React components for FramePay.js
Supported: React 14 to 19.
This package is a wrapper for FramePay offering out-of-the-box support for Redux and other common React features.
FramePayProvider
)withFramePay
) HOCwithFramePayCardComponent
) HOCwithFramePayBankComponent
) HOCFor more information on FramePay see its official documentation.
Install using Yarn:
yarn add @rebilly/framepay-react
Or using NPM:
npm install @rebilly/framepay-react --save
The example described in this readme can be found here (CodeSandbox)
FramePayProvider
)FramePayProvider provides settings to the FramePay API. See Framepay.initialize for a list of all configuration options.
// index.js
import React from 'react';
import { render } from 'react-dom';
import { FramePayProvider } from '@rebilly/framepay-react';
import MyCardPageComponent from './MyCardPageComponent';
const App = () => {
return (
<FramePayProvider publishableKey="pk_sandbox_1234567890">
<MyCardPageComponent/>
</FramePayProvider>
);
};
render(<App/>, document.getElementById('root'));
Define configuration parameters as attributes on the provider tag.
publishableKey="pk_sandbox_1234567890"
Please, don't implementing the unmount functionality, use the examples.
The react lifecycle methods already implemented in the library.
BankAccountNumberElement
BankAccountTypeElement
BankRoutingNumberElement
CardElement
CardCvvElement
CardExpiryElement
CardNumberElement
ApplePayElement
SamsungPayElement
GooglePayElement
PaypalElement
CardElement
CardCvvElement
CardExpiryElement
CardNumberElement
BankAccountNumberElement
BankAccountTypeElement
BankRoutingNumberElement
ApplePayElement
SamsungPayElement
GooglePayElement
PaypalElement
withFramePay
) HOCThis simple FramePay HOC is used to provide the Framepay
API in your component. It is most commonly used in combination with multiple payment methods.
withFramePayCardComponent
) HOCWrapper for the payment card features.
// MyCardPageComponent.js
import React from 'react';
import { withFramePayCardComponent } from '@rebilly/framepay-react';
class MyCardPageComponent extends React.Component {
constructor(props) {
super(props);
this.formNode = null;
this.state = { firstName: '', lastName: '' };
this.onSubmit = this.onSubmit.bind(this);
}
onSubmit(e) {
e.preventDefault();
// @see https://www.rebilly.com/docs/dev-docs/framepay-global-reference/#framepay.createtoken
this.props.Framepay.createToken(
this.formNode,
{ billingAddress: { ...this.state } }
)
.then(data => alert(JSON.stringify(data, null, 2)))
.catch(err => alert(JSON.stringify(err, null, 2)));
}
render() {
return (<form
ref={node => this.formNode = node}
onSubmit={this.onSubmit}>
<div>
<input
type="text"
name="firstName"
placeholder="First Name"
defaultValue={this.state.firstName}
onChange={(e) => this.setState({ firstName: e.target.value })}/>
</div>
<br/>
<div>
<input
type="text"
name="lastName"
placeholder="Last Name"
defaultValue={this.state.lastName}
onChange={(e) => this.setState({ lastName: e.target.value })}/>
</div>
<br/>
<this.props.CardElement/>
<hr/>
<button>Make Payment</button>
</form>);
}
}
export default withFramePayCardComponent(MyCardPageComponent);
withFramePayBankComponent
) HOCWrapper for the ACH features.
import React from 'react';
import { withFramePayBankComponent } from '@rebilly/framepay-react';
class MyBankPageComponent extends React.Component {
constructor(props) {
super(props);
this.formNode = null;
this.state = { firstName: '', lastName: '' };
this.onSubmit = this.onSubmit.bind(this);
}
onSubmit(e) {
e.preventDefault();
// @see https://www.rebilly.com/docs/dev-docs/framepay-global-reference/#framepay.createtoken
this.props.Framepay.createToken(
this.formNode,
{ billingAddress: { ...this.state } }
)
.then(data => alert(JSON.stringify(data, null, 2)))
.catch(err => alert(JSON.stringify(err, null, 2)));
}
render() {
return (<form
ref={node => this.formNode = node}
onSubmit={this.onSubmit}>
<div>
<input
type="text"
name="firstName"
placeholder="First Name"
defaultValue={this.state.firstName}
onChange={(e) => this.setState({ firstName: e.target.value })}/>
</div>
<br/>
<div>
<input
type="text"
name="lastName"
placeholder="Last Name"
defaultValue={this.state.lastName}
onChange={(e) => this.setState({ lastName: e.target.value })}/>
</div>
<br/>
<this.props.BankElement/>
<hr/>
<button>Make Payment</button>
</form>);
}
}
export default withFramePayBankComponent(MyBankPageComponent);
The framepay-react package supports all the FramePay initialization settings. See Framepay.initialize for all customizations.
<FramePayProvider publishableKey="pk_sandbox_1234567890">
<MyCardPageComponent/>
</FramePayProvider>
The CSS file is hosted on Rebilly's CDN and is found at this URL: https://cdn.rebilly.com/framepay/v1/rebilly.css
See adding default element styles in FramePay's documentation for more details.
The createToken
method supports all FramePay arguments. See Framepay.createToken for more details.
The methods withFramePay
, withFramePayCardComponent
and withFramePayBankComponent
are higher-order-components. They can't be called directly from your render()
method, so assign the generated component to a variable in the global scope before use.
import * as React from 'react';
import {withFramePayCardComponent} from '@rebilly/framepay-react'
class SomeComponent extends React.Component {
render(){
return(<div>
{withFramePayCardComponent(MyCardComponent)}
</div>)
}
}
import * as React from 'react';
import {withFramePayCardComponent} from '@rebilly/framepay-react'
const MyCardElement = withFramePayCardComponent(MyCardComponent);
class SomeComponent extends React.Component {
render(){
return(<div>
<MyCardElement />
</div>)
}
}
In order to manually preview the examples, use serve:e2e
command. It builds the project and starts the local server on the port 8000.
Unit tests can be run using the test:unit
command.
test:e2e:pr
- runs a smaller subset of E2E tests tests headlessly.test:e2e:post-merge
- runs the complete set of E2E tests tests headlessly.test:e2e:open
- opens the cypress GUI, allowing you to interact with each test visually.FAQs
A React wrapper for Rebilly's FramePay offering out-of-the-box support for Redux and other common React features
The npm package @rebilly/framepay-react receives a total of 0 weekly downloads. As such, @rebilly/framepay-react popularity was classified as not popular.
We found that @rebilly/framepay-react demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
npm author Qix’s account was compromised, with malicious versions of popular packages like chalk-template, color-convert, and strip-ansi published.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.