Skip to content

Commit 1dd3cab

Browse files
committed
Added Get Banks list and Account Confirmation
1 parent 4c50abd commit 1dd3cab

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/Paystack.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,4 +694,32 @@ public function updateSubAccount($subaccount_code)
694694
$this->setRequestOptions();
695695
return $this->setHttpResponse("/subaccount/{$subaccount_code}", "PUT", array_filter($data))->getResponse();
696696
}
697+
698+
699+
/**
700+
* Get a list of all supported banks and their properties
701+
* @param $country - The country from which to obtain the list of supported banks, $per_page - Specifies how many records to retrieve per page ,
702+
* $use_cursor - Flag to enable cursor pagination on the endpoint
703+
* @return array
704+
*/
705+
public function getBanks(?string $country, int $per_page = 50, bool $use_cursor = false)
706+
{
707+
if (!$country)
708+
$country = request()->country ?? 'nigeria';
709+
710+
$this->setRequestOptions();
711+
return $this->setHttpResponse("/bank/?country=" . $country . "&use_cursor=" . $use_cursor . "&perPage=" . (int) $per_page, "GET")->getResponse();
712+
}
713+
714+
/**
715+
* Confirm an account belongs to the right customer
716+
* @param $account_number - Account Number, $bank_code - You can get the list of bank codes by calling the List Banks endpoint
717+
* @return array
718+
*/
719+
public function confirmAccount(string $account_number, string $bank_code)
720+
{
721+
722+
$this->setRequestOptions();
723+
return $this->setHttpResponse("/bank/resolve/?account_number=" . $account_number . "&bank_code=" . $bank_code, "GET")->getResponse();
724+
}
697725
}

0 commit comments

Comments
 (0)