Giter Site home page Giter Site logo

olufemiobafunmiso / paystackjs-sample-code Goto Github PK

View Code? Open in Web Editor NEW

This project forked from paystackhq/paystackjs-sample-code

0.0 1.0 0.0 36 KB

Bare Paystack JS implementation. Style pay.html as required

Home Page: https://developers.paystack.co/page/paystackjs

PHP 21.84% JavaScript 58.77% HTML 19.39%

paystackjs-sample-code's Introduction

Barebones Checkout using PaystackJS

CONTENTS OF THIS FILE

  • Introduction
  • Requirements
  • Files
  • Installation
  • Configuration
  • Run
  • Test Verve card
  • Security

Introduction

You can now accept card details directly on your website while using PaystackJS to handle the checkout.

Requirements

To run this sample, you need an apache server that supports:

  • PHP 5.4
  • TLSv1.2

Files

This contains divs and forms whose ids and attributes have been set to the minimum required to conclude checkout. Please only add attributes to these except form#checkout-form which is our sample checkout ..

To make this work for you, add the divs and forms as they are to your existing checkout page and style them as required.

IMPORTANT NOTE:

TO AVOID MISTAKENLY SENDING ANY OF THE FORM INFORMATION TO YOUR BACKEND, DO NOT SET A name FOR ANY OF THE FIELDS IN THE PAYMENT FORMS.

This handles paystack.js on your behalf leaving you to only style the divs in pay.html

This contains sample checkout code that communicates with your backend to start a transaction, report client side errors and verify transactions when successful.

This will need to change in accordance with your flow. Do note that js/main.js calls 2 functions in this file: reportErrorToBackend and verifyTransactionOnBackend. If you have to change their names and/or parameters, remember to ensure js/main.js is edited to use them properly

This is a sample backend that communicates with paystack's API in the sample. You will probably have to dispose of this after reading through the sample code.

Your own backend will have to expose endpoints for getting an access code and verifying a transaction.

This is part of our sample backend which ensures index.php handles all requests. Again, you will probably have to dispose of this too.

Installation

Download the code and host on an Apache server that supports TLSv1.2 and at least PHP 5.4.

Configuration

Edit index.php providing your secret key.

Run

To run the sample, navigate to the folder where you unzipped the sample.

Test Verve card

Here is a test Verve card you can use with a test secret key:

  • Card PAN: 5060666666666666666
  • Card CVC: 123
  • Expiry Date: any future date
  • PIN: 1234
  • OTP: 123456

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Contact

For more enquiries and technical questions regarding this sample, please post on our issue tracker: https://github.com/PaystackHQ/PaystackJS-Sample-code/issues.

paystackjs-sample-code's People

Contributors

ibrahimlawal avatar kendysond avatar sauban avatar

Watchers

James Cloos 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.