npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

capacitor-inai

v0.0.5

Published

Inai Checkout plugin for ionic capacitor

Downloads

6

Readme

capacitor-inai

Capacitor wrapper around Inai Checkout Android and iOS SDK's

Installation

npm install capacitor-inai

Initialization

Inai Checkout has different methods that can be used to execute different types of operations related to payments. Let's discuss them in detail. Import the InaiCheckout as given below:


import { InaiCheckout } from 'capacitor-inai'

Drop-In Checkout

Present Checkout

Inai Present Checkout presents the customer with a list of configured payment method options for the country of checkout.

To invoke presentCheckout, pass an object with the following properties,

  • token key represents the client username can be obtained from the dashboard: Settings > Credentials.
  • orderId key represents the orderId refers to the inai order created by the merchant backend.
  • countryCode key represents the countryCode should be specified as an ISO 3166-1 alpha-3 country code.
  • styles key represents the optional styles object can be used to customize various UI elements on the checkout page.
  • locale key represents This adds localization to the SDK method that is being called. e.g "en" for English, "fr" for french.
  let styles = {
    container: { backgroundColor: "#fff" },
    cta: { backgroundColor: "#123456" },
    errorText: { color: "#000000" },
    components: [{ component: "cta", style: { backgroundColor: "#AA0082", border: "", color: "", fontSize: "14px", fontWeight: 400, margin: "0px", marginTop: "8px" } }]
  };

InaiCheckout.presentCheckout({
    token: "token",
    orderId: "orderId",
    countryCode: "countryCode",
    styles: styles,
    locale: locale
  }).then((response) => {
    // Handle Success
}).catch((err) => {
    // Handle Failure
});

Headless Checkout

Make Payment

This interface is used to do headless payments.

To invoke makePayment, pass an object with the following properties,

  • token key represents the client username can be obtained from the dashboard: Settings > Credentials.
  • orderId key represents the orderId refers to the inai order created by the merchant backend.
  • countryCode key represents the countryCode should be specified as an ISO 3166-1 alpha-3 country code.
  • paymentMethodOption key represents the payment method option the user chose to complete the payment.
  • paymentDetails key represents the payment details that are required to complete the payment for the payment method option specified. For Payment Method Options with empty form_fields, this must be set as an empty object {} A promise will be returned that will resolve or reject based on the input validation or payment status. Appropriate success/error messages can be presented to the customer based on the response.

const paymentMethodOption = "card"

const paymentDetails = {
            "fields": [{
              "name": "number", 
              "value": "4242424242424242"
            },{
              "name": "cvc", 
              "value": "123"
            },{
              "name": "expiry", 
              "value": "12/25"
            },{
              "name": "holder_name", 
              "value": "Test Account "
            },{
              "name": "contact_email", 
              "value": "[email protected]"
            }]
          }

InaiCheckout.makePayment({
    token: "token",
    orderId: "orderId",
    countryCode: "countryCode",
    paymentMethodOption, 
    paymentDetails}).then((response) => {
    // Handle Success
  }).catch((err) => {
    // Handle Failure
  });

Validate Fields

This interface is used to validate payment details entered by the customer.

To invoke validateFields, pass an object with the following properties,

  • token key represents the client username can be obtained from the dashboard: Settings > Credentials.
  • orderId key represents the orderId refers to the inai order created by the merchant backend.
  • countryCode key represents the countryCode should be specified as an ISO 3166-1 alpha-3 country code.
  • paymentMethodOption represents the payment method option the user chose to complete the payment.
  • paymentDetails represents the payment details that are required to complete the payment for the payment method option specified. For Payment Method Options with empty form_fields, this must be set as an empty object {} A promise will be returned that will resolve or reject based on the input validation or payment status. Appropriate success/error messages can be presented to the customer based on the response.

const paymentMethodOption = "card"

const paymentDetails = {
  "fields": [{
    "name": "number",
    "value": "5123456789012346"
  },{
    "name": "cvc",
    "value": "123"
  },{
    "name": "expiry",
    "value": "12/25"
  },{
    "name": "holder_name",
    "value": "John Doe"
  },{
    "name": "contact_number",
    "value": "01010101010"
  },{
    "name": "first_name",
    "value": "John"
  },{
    "name": "last_name",
    "value": "Doe"
  },{
    "name": "contact_email",
    "value": "[email protected]"
  }]
}

InaiCheckout.validateFields({ 
    token: "token",
    orderId: "orderId",
    countryCode: "countryCode",
    paymentMethodOption, 
    paymentDetails}).then((response) => {
  // Handle Success
}).catch((err) => {
  // Handle Failure
});

Get Card Info

This interface is used to get the card information.

To invoke getCardInfo, pass an object with the following properties,

  • token key represents the client username can be obtained from the dashboard: Settings > Credentials.
  • orderId key represents the orderId refers to the inai order created by the merchant backend.
  • countryCode key represents the countryCode should be specified as an ISO 3166-1 alpha-3 country code.
  • cardNumber represents the card number entered by the user.

A promise will be returned that will resolve or reject based on the input validation or payment status. Appropriate success/error messages can be presented to the customer based on the response.


const cardNumber = "424242"

InaiCheckout.getCardInfo({ 
    token: "token",
    orderId: "orderId",
    countryCode: "countryCode",
    cardNumber}).then((response) => {
    // Handle Success
  }).catch((err) => {
    // Handle Failure
  });

Get Installment plans

This interface is used to get the installment plans available for that payment.

To invoke getInstallmentPlans, pass an object with the following properties,

  • token key represents the client username can be obtained from the dashboard: Settings > Credentials.
  • orderId key represents the orderId refers to the inai order created by the merchant backend.
  • countryCode key represents the countryCode should be specified as an ISO 3166-1 alpha-3 country code.
  • paymentMethodOption represents the payment method option the user chose to complete the payment.
  • paymentDetails represents the payment details that are required to complete the payment for the payment method option specified. For Payment Method Options with empty form_fields, this must be set as an empty object {}

A promise will be returned that will resolve or reject based on the input validation or payment status. Appropriate success/error messages can be presented to the customer based on the response.

const paymentMethodOption = "card"

const paymentDetails = {
  "fields": [{
    "name": "number",
    "value": "5123456789012346"
  },{
    "name": "cvc",
    "value": "123"
  },{
    "name": "expiry",
    "value": "12/25"
  },{
    "name": "holder_name",
    "value": "John Doe"
  },{
    "name": "contact_number",
    "value": "01010101010"
  },{
    "name": "first_name",
    "value": "John"
  },{
    "name": "last_name",
    "value": "Doe"
  },{
    "name": "contact_email",
    "value": "[email protected]"
  }]
}

InaiCheckout.getInstallmentPlans({ 
    token: "token",
    orderId: "orderId",
    countryCode: "countryCode", 
    paymentMethodOption, 
    paymentDetails}).then((response) => {
    // Handle Success
  }).catch((err) => {
    // Handle Failure
  });