Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
@gocardless/react-dropin
Advanced tools
React bindings for the GoCardless Dropin checkout flow.
With npm:
npm install --save @gocardless/react-dropin
With yarn:
yarn add @gocardless/react-dropin
This library exports React hook functions that you can use to trigger a GoCardless Dropin instance.
Here is a simple example of an App
that wants to create a Billing Request Flow
ID via its backend API, then provide a DropinButton
that the payer can click
to trigger the Dropin.
See this in action at the GoCardlessDropinButton story
import React, { useCallback, useState } from "react";
import {
useGoCardlessDropin,
GoCardlessDropinOptions,
GoCardlessDropinOnSuccess,
} from "@gocardless/react-dropin";
// Display a button that opens the Dropin on click, starting a checkout
// flow for the specified Billing Request Flow.
const DropinButton = (options: GoCardlessDropinOptions) => {
const { open } = useGoCardlessDropin({ ...options });
return (
<button type="button" onClick={() => open()}>
Start Dropin for <code>{options.billingRequestFlowID}</code> in{" "}
<code>{options.environment}</code>
</button>
);
};
// Example checkout flow, where we create a Billing Request Flow ID by talking
// with our backend API.
const App: FunctionComponent = () => {
const [flowID, setFlowID] = useState<string | null>(null);
// Build your backend with an API endpoint that:
//
// 1. Creates a Billing Request for the resources you wish to create
// 2. Create a Billing Request Flow against (1)
// 3. Return the ID from (2)
//
// See an example of this at Taking an Instant Bank Payment:
// https://developer.gocardless.com/getting-started/billing-requests/taking-an-instant-bank-payment/
React.useEffect(() => {
async function createFlow() {
// Expecting a JSON body like:
// {
// "flow_id": "BRF123456"
// }
let response = await fetch("/api/flows", {
method: "POST",
});
const { flow_id } = await response.json();
setFlowID(flow_id);
}
createFlow();
}, []);
// Only show the button once we have a Billing Request Flow ID
return flowID === null ? (
<div className="loader"></div>
) : (
<DropinButton billingRequestFlowID={flowID} environment={"live"} />
);
};
Checkout the Storybook flow to see the <GoCardlessDropinButton />
in action.
You can use the Storybook knobs to configure the Billing Request Flow ID, from
which you can create your Dropin instance.
Stories are deployed to the gh-pages
branch of this repo, and hosted at
https://gocardless.github.io/react-dropin/.
CircleCI is configured to publish changes for us, via a build pipeline.
To trigger a new package version:
package.json
with the new version number (ie, v1.0.0)master
, then cut a new release in GitHub
with a tag name that matches the release (ie, v1.0.0)This should trigger the CI pipeline, and the new package version will appear on npm shortly.
FAQs
React bindings to the GoCardless Dropin checkout flow
The npm package @gocardless/react-dropin receives a total of 2,883 weekly downloads. As such, @gocardless/react-dropin popularity was classified as popular.
We found that @gocardless/react-dropin demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.