1. Go to this page and download the library: Download paybridge-np/sdk library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
$payment = $paybridgenp->payments->get('pay_xxxxxxxxxxxxxxxx');
echo $payment['status']; // success
echo $payment['provider_ref']; // provider's own transaction ID
echo $payment['metadata']['order_id']; // data you passed at checkout
$endpoint = $paybridgenp->webhooks->create([
'url' => 'https://myshop.com/webhooks/paybridgenp',
'events' => ['payment.succeeded', 'payment.failed'],
]);
// Save $endpoint['signing_secret'] somewhere safe (e.g. .env)
// It is shown ONCE and cannot be retrieved again.
echo $endpoint['signing_secret']; // whsec_...
use PayBridgeNP\Exceptions\PayBridgeException;
use PayBridgeNP\Exceptions\AuthenticationException;
use PayBridgeNP\Exceptions\InvalidRequestException;
use PayBridgeNP\Exceptions\RateLimitException;
use PayBridgeNP\Exceptions\SignatureVerificationException;
try {
$session = $paybridgenp->checkout->create(['amount' => 5000, 'return_url' => 'https://...']);
} catch (AuthenticationException $e) {
// Invalid or missing API key
echo $e->getMessage(); // "Invalid or missing API key"
echo $e->getStatusCode(); // 401
echo $e->getErrorCode(); // "authentication_error"
} catch (InvalidRequestException $e) {
// Bad parameters — check $e->getRaw() for field-level details
print_r($e->getRaw());
} catch (RateLimitException $e) {
// Too many requests — back off and retry
sleep(5);
} catch (PayBridgeException $e) {
// Catch-all for any other API error
echo $e->getStatusCode();
echo $e->getErrorCode(); // "api_error", "not_found_error", etc.
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.