Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

frames-react-native

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

frames-react-native

Beta Frames React Native

  • 1.0.0
  • npm
  • Socket score

Version published
Weekly downloads
2.9K
increased by6.56%
Maintainers
1
Weekly downloads
 
Created
Source

❗️BETA

Frames React Native

codecov Test and Deploy

Demo frames react native

:rocket: Install

yarn add frames-react-native

:computer: Import

import {
  Frames,
  CardNumber,
  ExpiryDate,
  Cvv,
  SubmitButton,
} from "frames-react-native";

:tada: Example

import React from "react";
import { StyleSheet, View, TouchableHighlight } from "react-native";
import {
  Frames,
  CardNumber,
  ExpiryDate,
  Cvv,
  SubmitButton,
} from "frames-react-native";

export default function App() {
  return (
    <View style={styles.container}>
      <Frames
        config={{
          debug: true,
          publicKey: "pk_test_4296fd52-efba-4a38-b6ce-cf0d93639d8a",
        }}
        cardTokenized={(e) => {
          alert(e.token);
        }}
      >
        <CardNumber style={styles.cardNumber} placeholderTextColor="#9898A0" />

        <View style={styles.dateAndCode}>
          <ExpiryDate
            style={styles.expiryDate}
            placeholderTextColor="#9898A0"
          />
          <Cvv style={styles.cvv} placeholderTextColor="#9898A0" />
        </View>

        <TouchableHighlight style={styles.button}>
          <SubmitButton
            title="Pay Now"
            onPress={() => console.log("merchant action")}
            color="#fff"
          />
        </TouchableHighlight>
      </Frames>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: "#000001",
    alignItems: "center",
    justifyContent: "flex-start",
    paddingTop: 80,
    paddingLeft: 10,
    paddingRight: 10,
  },
  dateAndCode: {
    marginTop: 15,
    flexDirection: "row",
    justifyContent: "space-between",
  },
  cardNumber: {
    fontSize: 18,
    height: 50,
    color: "#FEFFFF",
    backgroundColor: "#1B1C1E",
    borderColor: "#3A4452",
    borderRadius: 5,
    borderWidth: 0,
  },
  expiryDate: {
    fontSize: 18,
    height: 50,
    width: "48%",
    color: "#FEFFFF",
    backgroundColor: "#1B1C1E",
    borderWidth: 0,
  },
  cvv: {
    fontSize: 18,
    height: 50,
    width: "48%",
    color: "#FEFFFF",
    backgroundColor: "#1B1C1E",
    borderWidth: 0,
  },
  button: {
    height: 50,
    width: "100%",
    borderRadius: 5,
    backgroundColor: "#0E84FF",
    marginTop: 20,
    justifyContent: "center",
  },
});

Trigger tokenization

The tokenization is triggered when the SubmitButton is pressed. The process of getting the token is async, so the outcome of the tokenization will be shared in the cardTokenized or cardTokenizationFailed handlers.

The props for the Frames wrapper component

proptypedescription
config.publicKeystringThe public key from your Checkout.com account
config.debugbooleanTrigger the debug mode ()
config.cardholderobjectThe cardholder name and billing details

The cardholder information

proptypedescription
cardholder.namestringThe name of the cardholder
cardholder.phonestringThe phone number of the customer
cardholder.billingAddressobjectThe cardholder billing address
cardholder.billingAddress.addressLine1stringAddress line 1
cardholder.billingAddress.addressLine2stringAddress line 2
cardholder.billingAddress.zipstringZip
cardholder.billingAddress.citystringCity
cardholder.billingAddress.statestringState
cardholder.billingAddress.countrystringCountry

The handlers

proptypedescription
frameValidationChangedfunctionTriggered when a field's validation status has changed. Use it to show error messages or update the UI.
paymentMethodChangedfunctionTriggered when a valid payment method is detected based on the card number being entered.
cardValidationChangedfunctionTriggered when the state of the card validation changes.
cardTokenizedfunctionTriggered after a card is tokenized. Here you will get the card token alongside general card information
cardTokenizationFailedfunctionTriggered after the card tokenization fails.

FAQs

Package last updated on 26 Apr 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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc