*

Smithtech

  • ****
  • 219 posts
PAYSTACK payment gateway supports GHS
« on: May 24, 2021, 08:41:11 PM »
Hi Team,
Paystack actually supports GHS as well. However, It is stated on the plugin page that Paystack only supports NGN and USD so Paystack will not work unless we change the currency.
We have only GHS currency and enabled the Paystack payment but it is not showing in the payment methods in user dashboard. Can you please address this issue so that we can use the plugin for GHS.

Kindly have a look at this JS on this Paystack page https://paystack.com/docs/payments/accept-payments

Paystack supports GHS. It looks like GHS is actually the second currency after NGN.

Code: [Select]
var paymentForm = document.getElementById('paymentForm');
paymentForm.addEventListener('submit', payWithPaystack, false);
function payWithPaystack() {
var handler = PaystackPop.setup({
key: 'YOUR_PUBLIC_KEY', // Replace with your public key
email: document.getElementById('email-address').value,
amount: document.getElementById('amount').value * 100, // the amount value is multiplied by 100 to convert to the lowest currency unit
currency: 'NGN', // Use GHS for Ghana Cedis or USD for US Dollars
ref: 'YOUR_REFERENCE', // Replace with a reference you generated
callback: function(response) {
//this happens after the payment is completed successfully
var reference = response.reference;
alert('Payment complete! Reference: ' + reference);
// Make an AJAX call to your server with the reference to verify the transaction
},
onClose: function() {
alert('Transaction was not completed, window closed.');
},
});
handler.openIframe();
}

Marked as best answer by frosticek on May 30, 2021, 08:40:46 AM
*

MB Themes

Re: PAYSTACK payment gateway supports GHS
« Reply #1 on: May 25, 2021, 07:42:40 AM »
@support
In functions.php of plugin find:
Code: [Select]
  if(osp_param('paystack_enabled') == 1 && in_array(osp_currency(), array('NGN', 'USD'))) {

Change to:
Code: [Select]
if(osp_param('paystack_enabled') == 1 && in_array(osp_currency(), array('GHS', 'NGN', 'USD'))) {
In admin/gateway.php find:
Code: [Select]
<?php if(!in_array(osp_currency(), array('NGN''USD'))) { ?>
Replace with:
Code: [Select]
<?php if(!in_array(osp_currency(), array('NGN''GHS''USD'))) { ?>
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Smithtech

  • ****
  • 219 posts
Re: PAYSTACK payment gateway supports GHS
« Reply #2 on: May 30, 2021, 03:05:54 AM »
Thank You.
It worked