Giter Site home page Giter Site logo

iykekings / svelte-paystack Goto Github PK

View Code? Open in Web Editor NEW
7.0 1.0 5.0 536 KB

A svelte library for implementing Paystack payment gateway

Home Page: https://www.npmjs.com/package/svelte-paystack

CSS 18.03% HTML 7.87% JavaScript 26.60% Svelte 47.13% Shell 0.38%
svelte-library svelte paystack-payment-gateway paystack paystack-library

svelte-paystack's Introduction

Svelte-paystack

A svelte library for implementing paystack payment gateway

Getting started

Install

  npm i svelte-paystack

Use

Import Paystack component as the default export from svelte-paystack and pass in your paystack configuration to it as config prop. This configuration can be found in your paystack dashboard.

<script>
  import Paystack from 'svelte-paystack';

  //import your custom-component
  import Button from 'your-path'

  let config = {
    key: "pk_test_or_public_key",
    email: "[email protected]",
    amount: 10000, 
    currency: "NGN",
    withSlot:true, // If you need to render a custom component to replace default button
    embed: false,
    disabled: false,
    callback: function(response) {
      console.log(
        "successfully subscribed. transaction ref is " + response.reference
      );
    },
    onClose: function() {
      console.log("window closed");
    }
  }
</script>
<Paystack {config} />

//Pass custom component to paystack
<Paystack let:usePayInline {config}>

  //action props from your custom-component will receive func to invoke paystack inline, which you can attach to any event inside your custom-component.
<Button action={usePayInline}  />
  </Paystack action>

Configuration Options

  • For embed: true all Configuration options specified here by paystack embed can be specified.

  • For embed: false all Configuration options specified here by paystack inline can be specified.

  • For withSlot: true works in conjunction with embed: false, which gives you the option of using custom component to trigger paystack inline can be specified.

  • More configs:

      embed: boolean // specifies if the payment form should be embedded. Defaults to false
      value: string // textContent of the button tag when embed == false. Defaults to "Pay with Paystack"

Examples

svelte-paystack's People

Contributors

dependabot[bot] avatar imgbotapp avatar iykekings avatar mbappai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.