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

@alliance-software-development/asdpay

v1.0.0

Published

A cross platform ASD Payment module

Downloads

4

Readme

A React component for AfterClearpay and Affirm payment.

Installation

React Native implementation for Afterpay or Clearpay payment.

Description

The library allows you to use AfterClearpay Checkout and Affirm Checkout with react-native without ejecting. You can use it with both server-side implementations and client-side implementations. Simply ensure you follow the url structure guidelines below.

Prequisites

Installation

  • Ensure you've completed the setps in prequisites.

  • Install package via npm or yarn:

npm install @alliance-software-development/asdpay

or

yarn add @alliance-software-development/asdpay
  • Import in your project
import ASDPay from "@alliance-software-development/asdpay";

Usage

import ASDPay from "@alliance-software-development/asdpay";

const App = () => (
  <ASDPay
    paymentType="Affirm" // ['AfterClearPay', 'Affirm']
    publicKey={PUBLIC_KEY}
    client_secret={CLIENT_SECRET} // required only for AfterClearPay
    checkoutSessionInput={{}}
    onComplete={(res) => {
      console.log(`Checkout session succeeded. session id: ${res}.`);
    }}
  />
);

export default App;

Affirm Usage

<ASDPay
  paymentType="Affirm"
  publicKey="{PUBLC_KEY}"
  checkoutSessionInput={{
    merchant: {
      user_cancel_url: "https://www.affirm.com/?status=cancel",
      user_confirmation_url: "https://www.affirm.com/?status=complete",
      user_confirmation_url_action: "GET",
      merchant: "Affirm Demo Inc."
    },

    shipping: {
      name: {
        first: "John",
        last: "Doe"
      },
      address: {
        line1: "225 Bush Street.'",
        line2: "Floor 16",
        city: "San Francisco",
        state: "CA",
        country: "US",
        zipcode: "94104"
      },
      email: "[email protected]",
      phone_number: "4155555555"
    },
    billing: {
      name: {
        first: "John",
        last: "Doe"
      },
      address: {
        line1: "225 Bush Street.'",
        line2: "Floor 16",
        city: "Beckley",
        state: "CA",
        country: "US",
        zipcode: "24801"
      },
      email: "[email protected]",
      phone_number: "4155555555"
    },
    items: [
      {
        sku: "123456789",
        display_name: "Affirm Scarf",
        unit_price: 60000,
        qty: 1
      }
    ],
    order_id: "JKLMO4322",
    currency: "USD",
    financing_program: "flyus_3z6r13r",
    shipping_amount: 1000,
    tax_amount: 500,
    total: 100000
  }}
  onComplete={(res) => {
    alert(JSON.stringify(res));
  }}
/>

AfterClearpay Usage

<ASDPay
  paymentType="AfterClearPay"
  publicKey="{PUBLIC_KEY}"
  client_secret="{CLIENT_SECRET}"
  checkoutSessionInput={{
    payment_method: {
      billing_details: {
        email: "[email protected]",
        name: "Jenny Rosen",
        address: {
          line1: "1234 Main Street",
          city: "San Francisco",
          state: "CA",
          country: "US",
          postal_code: "94111"
        }
      }
    },
    return_url: "https://imaginationeverywhere.info/?status=complete"
  }}
  onComplete={(res) => {
    alert(JSON.stringify(res));
  }}
/>

To get client_secret for AfterClearPay payment click here

Important Notes about checkoutSessionInput

checkoutSessionInput: {
          payment_method: {
            billing_details: {
              email: '[email protected]',
              name: 'Jenny Rosen',
              address: {
                line1: '1234 Main Street',
                city: 'San Francisco',
                state: 'CA',
                country: 'US',
                postal_code: '94111',
              },
            },
          },
          return_url: 'https://imaginationeverywhere.info/?status=complete',
        }
checkoutSessionInput: {
          merchant: {
            user_cancel_url: 'https://www.affirm.com/?status=cancel',
            user_confirmation_url: 'https://www.affirm.com/?status=complete',
            user_confirmation_url_action: 'GET',
            merchant: 'Affirm Demo Inc.'
          },

          shipping: {
            name: {
              first: 'John',
              last: 'Doe'
            },
            address: {
              line1: "225 Bush Street.'",
              line2: 'Floor 16',
              city: 'San Francisco',
              state: 'CA',
              country: 'US',
              zipcode: '94104'
            },
            email: '[email protected]',
            phone_number: '4155555555'
          },
          billing: {
            name: {
              first: 'John',
              last: 'Doe'
            },
            address: {
              line1: "225 Bush Street.'",
              line2: 'Floor 16',
              city: 'Beckley',
              state: 'CA',
              country: 'US',
              zipcode: '24801'
            },
            email: '[email protected]',
            phone_number: '4155555555'
          },
          items: [
            {
              sku: '123456789',
              display_name: 'Affirm Scarf',
              unit_price: 60000,
              qty: 1
            }
          ],
          order_id: 'JKLMO4322',
          currency: 'USD',
          financing_program: 'flyus_3z6r13r',
          shipping_amount: 1000,
          tax_amount: 500,
          total: 100000
        }

Important Notes about URLs

  • For AfterClearPay return_url must have the query string params ?status=complete

  • For Affirm:

    • user_cancel_url must have the query string params ?status=cancel

    • user_confirmation_url must have the query string params ?status=complete

Component props

  • publicKey (String) - Stripe public key of your project.

  • client_secret (String) - for AfterClearPay only; client secret from the paymentIntent Doc here

  • checkoutSessionInput (Object) - Object to be passed to Stripe's redirectToCheckout function Docs. or Affirm's redirect checkoutObject. Docs.

  • onComplete (?Function) - Called upon success or failure of the checkout session with { ...props }

  • webViewProps (?Object) - WebView Component props, spread on the WebView Component.

Implementation on Web

For AffirmPay

For AfterClearpay