Skip to content

Added List Banks and Account Confirmation #179

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions src/Paystack.php
Original file line number Diff line number Diff line change
Expand Up @@ -694,4 +694,32 @@ public function updateSubAccount($subaccount_code)
$this->setRequestOptions();
return $this->setHttpResponse("/subaccount/{$subaccount_code}", "PUT", array_filter($data))->getResponse();
}


/**
* Get a list of all supported banks and their properties
* @param $country - The country from which to obtain the list of supported banks, $per_page - Specifies how many records to retrieve per page ,
* $use_cursor - Flag to enable cursor pagination on the endpoint
* @return array
*/
public function getBanks(?string $country, int $per_page = 50, bool $use_cursor = false)
{
if (!$country)
$country = request()->country ?? 'nigeria';

$this->setRequestOptions();
return $this->setHttpResponse("/bank/?country=" . $country . "&use_cursor=" . $use_cursor . "&perPage=" . (int) $per_page, "GET")->getResponse();
}

/**
* Confirm an account belongs to the right customer
* @param $account_number - Account Number, $bank_code - You can get the list of bank codes by calling the List Banks endpoint
* @return array
*/
public function confirmAccount(string $account_number, string $bank_code)
{

$this->setRequestOptions();
return $this->setHttpResponse("/bank/resolve/?account_number=" . $account_number . "&bank_code=" . $bank_code, "GET")->getResponse();
}
}