Skip to content

mbappai/svelte-paystack

 
 

Repository files navigation

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';
  let config = {
    key: "pk_test_or_public_key",
    email: "youremail@email.com",
    amount: 10000, 
    currency: "NGN",
    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} />

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.

  • 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

  • Inline

  • Embed

About

A svelte library for implementing Paystack payment gateway

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • HTML 48.0%
  • JavaScript 31.0%
  • CSS 21.0%