skyflow-js 2.4.2 → 2.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -25,7 +25,7 @@ Skyflow’s JavaScript SDK can be used to securely collect, tokenize, and reveal
25
25
  Using script tag
26
26
 
27
27
  ```html
28
- <script src="https://js.skyflow.com/v1/index.js"></script>
28
+ <script src="https://js.skyflow.com/v2/index.js"></script>
29
29
  ```
30
30
 
31
31
 
@@ -134,6 +134,7 @@ For `env` parameter, there are 2 accepted values in Skyflow.Env
134
134
  - [**Insert data into the vault**](#insert-data-into-the-vault)
135
135
  - [**Using Skyflow Elements to collect data**](#using-skyflow-elements-to-collect-data)
136
136
  - [**Using Skyflow Elements to update data**](#using-skyflow-elements-to-update-data)
137
+ - [**Bin lookup**](#bin-lookup)
137
138
  - [**Using validations on Collect Elements**](#validations)
138
139
  - [**Event Listener on Collect Elements**](#event-listener-on-collect-elements)
139
140
  - [**UI Error for Collect Elements**](#ui-error-for-collect-elements)
@@ -745,6 +746,97 @@ cvvElement.mount('#cvv'); //Assumes there is a div with id='#cvv' in the webpage
745
746
  ]
746
747
  }
747
748
  ```
749
+
750
+ ## BIN Lookup
751
+
752
+ Skyflow supports BIN (Bank Identification Number) lookup to help identify co-badged cards and enable card network selection.
753
+
754
+ **What is BIN Lookup?**
755
+ A Bank Identification Number (BIN) represents the first 8 digits of a card number and identifies the issuing bank, card scheme, and country.
756
+ For co-badged cards, merchants are required to offer consumers a choice of which network to process the payment through.
757
+ You can use Skyflow’s BIN Lookup API to detect such cards and provide the appropriate options to users.
758
+
759
+ ### Example: Calling the BIN Lookup API
760
+ ```javascript
761
+ // Function to call Skyflow's BIN Lookup API
762
+ const binLookup = (bin) => {
763
+ const myHeaders = new Headers();
764
+ myHeaders.append("X-skyflow-authorization", "<BEARER_TOKEN>"); // TODO: replace bearer token
765
+ myHeaders.append("Content-Type", "application/json");
766
+
767
+ const raw = JSON.stringify({
768
+ "BIN": bin
769
+ });
770
+
771
+ const requestOptions = {
772
+ method: "POST",
773
+ headers: myHeaders,
774
+ body: raw,
775
+ redirect: "follow"
776
+ };
777
+
778
+ // TODO: replace <VAULT_URL> with your Skyflow vault URL
779
+ return fetch(`${VAULT_URL}/v1/card_lookup`, requestOptions);
780
+ };
781
+ ```
782
+
783
+ **Sample Response :**
784
+ ```javascript
785
+ {
786
+ "cards_data": [
787
+ {
788
+ "BIN": "54284800",
789
+ "issuer_name": "CREDIT MUTUEL ARKEA",
790
+ "country_code": "FR",
791
+ "currency": "",
792
+ "card_type": "Credit",
793
+ "card_category": "",
794
+ "card_scheme": "CARTES BANCAIRES"
795
+ },
796
+ {
797
+ "BIN": "54284800",
798
+ "issuer_name": "Credit Mutuel Arkea",
799
+ "country_code": "FR",
800
+ "currency": "",
801
+ "card_type": "Credit",
802
+ "card_category": "Mastercard Standard",
803
+ "card_scheme": "MASTERCARD"
804
+ }
805
+ ]
806
+ }
807
+ ```
808
+
809
+ ### Updating the Card Element with Network Schemes
810
+ ```javascript
811
+ const options = {
812
+ required: false, // Optional, indicates whether the field is marked as required. Defaults to 'false'.
813
+ enableCardIcon: true, // Optional, indicates whether a card icon should be enabled (only applicable for CARD_NUMBER ElementType).
814
+ enableCopy: false, // Optional, enables the copy icon to collect elements to copy text to clipboard. Defaults to 'false').
815
+ format: String, // Optional, format for the element
816
+ translation: {}, // Optional, indicates the allowed data type value for format.
817
+ cardMetadata: {}, // Optional, metadata to control card number element behavior. (only applicable for CARD_NUMBER ElementType).
818
+ masking: true, // Optional, indicates whether the input should be masked. Defaults to 'false'.
819
+ maskingChar: '*', // Optional, character used for masking input when masking is enabled. Defaults to '*'.
820
+ };
821
+ ```
822
+
823
+ `cardMetadata`: An object of metadata keys to control card number element behavior. It supports an optional key called `scheme`, which accepts an array of Skyflow accept card types based on which SDK will display card brand choice dropdown in the card number element. `Skyflow.CardType` is an enum with all skyflow supported card schemes.
824
+
825
+ ```javascript
826
+ import Skyflow from 'skyflow-js'
827
+
828
+ const cardMetadata = {
829
+ scheme: Skyflow.CardType [] // Optional, array of skyflow supported card types.
830
+ }
831
+ ```
832
+
833
+ - By default, SDK will populate its own auto-detected card scheme.
834
+
835
+ ### Samples
836
+
837
+ - [Card brand choice](https://github.com/skyflowapi/skyflow-js/blob/main/samples/using-script-tag/card-brand-choice.html):
838
+ This sample illustrates how to use Bin Lookup API and display the available card schemes.
839
+
748
840
  ## Using Skyflow Elements to update data
749
841
 
750
842
  You can update the data in a vault with Skyflow Elements. Use the following steps to securely update data.