Recurring payments with Paystack

AbdulQudus Yunus
2 min readJan 15, 2021

--

Paystack is a leading payment gateway in Africa. In this post I will be covering how to make recurring charges with paystack, the code will be provided in Laravel/VueJS.

They are some cases when you might need a way to charge your user automatically with their saved card authorization instead of asking for their credit card for every transaction.

To demonstrate the recurrent payment system I created a simple wallet system, where a user can fund their wallet with a saved card and also view their wallet history. In some cases in the real world, the subsequent recurrent payments are done automatically. For instance a user might be charged automatically at the end of every month in a subscription service. For the sake of demonstration and also for this particular use case the user only get charged when they credit their wallet.

The code for the wallet system can be found here. So lets go through the user story of the wallet application.

  • Registration of the user
  • The user make their first transfer to their wallet which is done by adding their card — At the completion of this process the necessary card authorization are saved for subsequent payments
  • The user can credit their wallet subsequently without the need of them using adding their card all over again
  • The user can choose to delete their card
  • The user can view their wallet history
Wallet system demo

Paystack documentation is very explanatory, so you can go through their official documentation of this process without much problem. To make a recurrent charge using paystack read and follow the steps in the doc — https://paystack.com/docs/payments/recurring-charges.

I will like to mention that recurring payments should only be implemented when required. A user should only have their card (authorization) saved when it is absolutely necessary. For example, a user will most likely not expect their card to be saved after checkout in a simple e-commerce app. So therefore in that case their card (authorization) should not be saved except the user permits it (after prompting the user).

In a case where you are offering a subscription kind of service, the user card credit will most likely be saved during registration or after a first transaction, for the purpose of subsequent automatic payments. Even in cases like this, it should still be clearly stated in the company terms and conditions how billing is handled generally.

Thats it on recurrent payments with paystack. Here is the link to the code once again. You can use the comment section for any feedback or questions. Thanks for reading.

--

--

No responses yet