Home / php / how to integrate paystack payment system with PHP

how to integrate paystack payment system with PHP

Integrating Paystack to your website is very easy, you can do it in just 2 steps.

Step 1: Initialize the payment
Step 2: Verify the payment was successful

Step 1: Initialize the payment

First you’d have to decide if you want to use the inline method or standard  method.

  1. With Inline integration, you keep the payment experience on your website.
  2. While with the Standard integration, your users will be redirected to Paystack’s website to pay and redirected back to your website after payment.

NB: The amount passed is in Kobo (A positive integer in the smallest currency unit), so you’d have to multiply the Naira amount by 100 to get the Kobo value. Eg NGN 100 should be passed as 10000

In this tutorial,  you will learn how to use the Standard method

NB: Before you can receive payment with paystack, you need to have an account with paystack account.

For this tutorial, i have created three files index.php, pay.php and verify.php

index.php:  contains lists of our product

 

pay.php:

when the BUY NOW button is submitted from the index.php,  you are redirected to the authorization URL. This URL is valid for one time use, so ensure that you generate a new URL per transaction.

When the payment is successful, we will call your callback URL (as setup in your dashboard) and return the reference sent in the first step as a query parameter.

 

verify.php : 

Before giving value to your customer, you should verify the status of the transaction by passing the reference to the API.

Source: https://chiwex.com/integrate-paystack-payment-system/
Reference: https://developers.paystack.co/page/integrating-paystack-php

About admin

Check Also

How to generate a random expression with php

If you are looking for a code function to generate a random expression, like password …

4 comments

  1. Can you offer the service of integration?

  2. Hi Admin,

    how can i resolve this error

    PHP Parse error: syntax error, unexpected ‘[‘ on pay.php

  3. Hi Admin,

    Got it resolved.

    Please where can i call the verify.php

Leave a Reply

Your email address will not be published. Required fields are marked *