Skip to content

Commit 8df8d92

Browse files
Merge pull request #179 from PrevailExcel/addfeature
Added List Banks and Account Confirmation
2 parents e7c8493 + 1dd3cab commit 8df8d92

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
@@ -697,4 +697,32 @@ public function updateSubAccount($subaccount_code)
697697
$this->setRequestOptions();
698698
return $this->setHttpResponse("/subaccount/{$subaccount_code}", "PUT", array_filter($data))->getResponse();
699699
}
700+
701+
702+
/**
703+
* Get a list of all supported banks and their properties
704+
* @param $country - The country from which to obtain the list of supported banks, $per_page - Specifies how many records to retrieve per page ,
705+
* $use_cursor - Flag to enable cursor pagination on the endpoint
706+
* @return array
707+
*/
708+
public function getBanks(?string $country, int $per_page = 50, bool $use_cursor = false)
709+
{
710+
if (!$country)
711+
$country = request()->country ?? 'nigeria';
712+
713+
$this->setRequestOptions();
714+
return $this->setHttpResponse("/bank/?country=" . $country . "&use_cursor=" . $use_cursor . "&perPage=" . (int) $per_page, "GET")->getResponse();
715+
}
716+
717+
/**
718+
* Confirm an account belongs to the right customer
719+
* @param $account_number - Account Number, $bank_code - You can get the list of bank codes by calling the List Banks endpoint
720+
* @return array
721+
*/
722+
public function confirmAccount(string $account_number, string $bank_code)
723+
{
724+
725+
$this->setRequestOptions();
726+
return $this->setHttpResponse("/bank/resolve/?account_number=" . $account_number . "&bank_code=" . $bank_code, "GET")->getResponse();
727+
}
700728
}

0 commit comments

Comments
 (0)