Paystack

The Paystack Developer Documentation

Welcome to the Paystack Developer Documentation.

You'll find comprehensive guides and documentation to help you start working with Paystack as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    Discussion

Paystack Inline Embed

Paystack Inline Embed is the latest addition to the stack, it offers a stylish Inline that loads the credit card form in a set container like it sits in your page.

Working with Paystack Inline Embded

Here is a sample code that calls Paystack and also handles outcome.

Key

Please note that the key to use with inline is the public key and not the secret key

<script src="https://js.paystack.co/v1/inline.js"></script>
<div id="paystackEmbedContainer"></div>

<script>
  PaystackPop.setup({
   key: 'pk_test_221221122121',
   email: 'customer@email.com',
   amount: 10000,
   container: 'paystackEmbedContainer',
   callback: function(response){
        alert('successfully subscribed. transaction ref is ' + response.reference);
    },
  });
</script>

Things to note while using Inline Embed

  1. You need to specify a container div that will house the form. All classes and styles on this div will be reset.
  2. The embed will automatically load in the container. No need to call loadIframe() on the Paystack instance
  3. The payment form will be 100% of the width of wherever you put it.
  4. To maintain a uniform design, your page's background color should be white.

When the user enters their card details, Paystack will validate the card, charge the card, and pass a response object (containing the status of the transaction including reference as reference) to your callback function. If no callback function is set, we will insert a hidden field named paystack-reference on the parent form and submit the form to whatever action you set.

Before you give value to the customer, please make a server-side call to our verification endpoint to confirm the status and properties of the transaction.

Configuration options

'*' indicates required parameters.

Options
Description

key*

Your publishable Key from Paystack. Use test key for test mode and live key for live mode

reference*

Unique transaction reference

email*

The customer's email address.

amount*

Amount in kobo. Ignored if creating a subscription.

callback

Javascript function that should be called if the payment is successful

currency

Currency charge should be performed in. Default is NGN

plan

If transaction is to create a subscription to a predefined plan, provide plan code here.

quantity

Used to apply a multiple to the amount returned by the plan code above.

For Split Payments

subaccount

( string ) The code for the subaccount that owns the payment. e.g. ACCT_8f4s1eq7ml6rlzj

transaction_charge

( integer, optional ) A flat fee to charge the subaccount for this transaction, in kobo. This overrides the split percentage set when the subaccount was created. Ideally, you will need to use this if you are splitting in flat rates (since subaccount creation only allows for percentage split). e.g. 7000 for a 70 naira flat fee.

bearer

( string, optional ) Who bears Paystack charges? account or subaccount. Defaults to account.

Paystack Inline Embed