Socket
Socket
Sign inDemoInstall

@cloudflare/component-payment-method-form-v2

Package Overview
Dependencies
36
Maintainers
21
Versions
216
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cloudflare/component-payment-method-form-v2

> PaymentMethod Form for Dash and Teams Dash


Version published
Weekly downloads
973
decreased by-1.42%
Maintainers
21
Created
Weekly downloads
 

Readme

Source

component-payment-method-form-v2

PaymentMethod Form for Dash and Teams Dash

This component is created specifically to be used on Dash and Teams dashboard. There are some setup requirements needed in order to properly consumer @cloudflare/payment-method-form-v2.

  1. import fieldsReducer and set it to fields key (required by @cloudflare/redux-fields)
  2. import hCaptchaReducer and set it to the billing.captcha key
  3. import creditCardProcessorReducer and set it to billing.creditCardProcessor key
  4. Bootstrap Stripe Elements provider during app init. Documentation can be found https://stripe.com/docs/stripe-js/react#elements-provider.
  5. We want to defer loading of stripe-js script until loadStripe is called. Explaination can be found https://github.com/stripe/stripe-js#importing-loadstripe-without-side-effects
  6. import sparrow and initial. Documentaiotn can be found https://www.npmjs.com/package/@cloudflare/util-sparrow
import { loadStripe } from '@stripe/stripe-js/pure';
import { Elements } from '@stripe/react-stripe-js';

const stripePromise = loadStripe('pk_12345678');

render(
  <Elements stripe={stripePromise}>
    <App/>
  </Elements>
);

import {
  fieldsReducer as billingFieldsReducer,
  hCaptchaReducer as billingHCaptchaReducer,
  credititCardProcessorReducer
} from '@cloudflare/component-payment-method-form-v2'


const appReducers = combineReducers({
  fields: billingFieldsReducer,
  billing: combineReducers({
    captcha: billingHCaptchaReducer,
    creditCardProcessor: credititCardProcessorReducer
  }),
})
import sparrow from '@cloudflare/util-sparrow'

sparrow.init({
  clientId: 'client-id-string',
  debug: production ? true : false,
  enabled: production ? true : false
  url: production ? 'https://sparrow.cloudflare.com' : ''
})

Installation

$ yarn add @cloudflare/component-payment-method-form-v2

Usage

import React from 'react';
import PaymentMethodForm from './src/index';

class ComponentWithPaymentMethodForm extends React.Component {
  render() {
    return (
      <PaymentMethodForm
          accountId={'12345'}
          updateBillingProfile={() => {}}
          createBillingProfile={() => {}}
        />
    );
  }
}

export default ComponentWithRecaptcha;

FAQs

Last updated on 07 Dec 2021

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc