How to use the payment.fns function in payment

To help you get started, we’ve selected a few payment examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github medipass / react-credit-card-input / src / InputField.js View on Github external
componentDidMount() {
    const { cardNumber } = this.state;
    const cardType = payment.fns.cardType(cardNumber);
    this.setState({
      cardImage: CARD_IMAGES[cardType] || placeholder
    });
  }
github z-dev / react-native-checkout / src / components / addCard / index.js View on Github external
isCardNumberValid() {
    return payment.fns.validateCardNumber(this.state.cardNumber)
  }
  isExpiryValid() {
github lorensr / react-payment / src / CardForm.js View on Github external
isValid: (otherValues, card) => {
              return Payment.fns.validateCardNumber(card)
            }
          }}
github sonnylazuardi / react-native-credit-card / index.js View on Github external
Component
} = React;

import Payment from 'payment';
import FlipCard from 'react-native-flip-card';

import {
    View,
    TouchableOpacity,
    Text,
    StyleSheet,
    Platform,
    Image
} from 'react-native';
const images = require('./card-images');
const validate = Payment.fns;

class CreditCard extends Component {
    constructor(props) {
        super(props);
        this.state = {
            type: {
                name:"unknown",
                length: 16
            }
        }
    }
    getValue(name) {
        return this[name]();
    }
    componentWillReceiveProps(nextProps) {
        this.updateType(nextProps);
github medipass / react-credit-card-input / src / InputField.js View on Github external
{};
    const cardTypeLengths = cardTypeInfo.lengths || [16];
    this.setState({
      cardImage: CARD_IMAGES[cardType] || placeholder,
      cardNumber
    });

    payment.formatCardNumber(document.getElementById('card-number'));

    this.setFieldValid();
    if (cardTypeLengths) {
      const lastCardTypeLength = cardTypeLengths[cardTypeLengths.length - 1];
      for (let length of cardTypeLengths) {
        if (
          length === cardNumberLength &&
          payment.fns.validateCardNumber(cardNumber)
        ) {
          document.getElementById('card-expiry').focus();
          break;
        }
        if (cardNumberLength === lastCardTypeLength) {
          this.setFieldInvalid('Card number is invalid');
        }
      }
    }

    const { cardNumberInputProps } = this.props;
    if (cardNumberInputProps.onChange) {
      cardNumberInputProps.onChange(e);
    }
  }
github medipass / react-credit-card-input / src / index.js View on Github external
this.setState({ cardNumber: this.cardNumberField.value }, () => {
      const cardType = payment.fns.cardType(this.state.cardNumber);
      const images = this.images;
      this.setState({
        cardImage: images[cardType] || images.placeholder
      });
    });
  };

payment

A general purpose library for building credit card forms, validating inputs and formatting numbers. Base on jquery.payment by @stripe, but without the jQuery.

MIT
Latest version published 5 months ago

Package Health Score

71 / 100
Full package analysis