Download the PHP package paybridge-np/sdk without Composer

On this page you can find all versions of the php package paybridge-np/sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package sdk

PayBridgeNP — PHP SDK

Official PHP SDK for PayBridgeNP — accept eSewa, Khalti, and Fonepay through a single API.

Requirements: PHP 7.4+, ext-curl, ext-json


Installation


Quick Start

The customer lands on a hosted checkout page, picks their payment method (eSewa / Khalti), pays, and is redirected back to your return_url with:


Configuration

Use sk_test_ keys for sandbox mode — no real money moves. Switch to sk_live_ for production.


Checkout

Create a session

If you pass provider upfront, the response also includes payment_method with the direct redirect URL or form fields — useful if you want to skip the hosted page entirely.

Expire a session

Use this when you mint a fresh session for a logical purchase that already had one outstanding (e.g. a customer requesting a new payment link), so the old URL stops being payable immediately rather than waiting for its 30-minute TTL. Idempotent on already-terminal sessions.

Laravel example


Payments

List payments

Retrieve a payment


Webhooks

Webhooks let PayBridgeNP notify your server when a payment is completed or fails. You register an endpoint URL, and we POST a signed JSON payload to it for every event.

1. Register an endpoint

2. Handle incoming webhooks

Always verify the signature before trusting the payload.

Plain PHP:

Laravel:

Important: Always pass the raw request body to constructEvent() — do not json_decode it first. The HMAC is computed over the raw string.

Important: Disable CSRF verification for your webhook route in Laravel (VerifyCsrfToken middleware).

Manage endpoints


Webhook Events

Event When it fires
payment.succeeded Payment verified successfully
payment.failed Payment attempted but failed or cancelled

Every event payload has this shape:


Error Handling

All API errors throw a subclass of PayBridgeNP\Exceptions\PayBridgeException.

Exception reference

Class Status getErrorCode()
AuthenticationException 401 authentication_error
PermissionException 403 permission_error
NotFoundException 404 not_found_error
InvalidRequestException 400 / 422 invalid_request_error
RateLimitException 429 rate_limit_error
SignatureVerificationException signature_verification_error
ConnectionException connection_error
PayBridgeException any api_error

Sandbox Testing

Use sk_test_ API keys to test without real money. The sandbox uses provider test environments:

Provider Test credentials
eSewa Merchant code: EPAYTEST, secret: 8gBm/:&EnhH.1/q — pre-configured, no setup needed
Khalti Secret key: test_secret_key_f59e8b7d18b4499ca40f68195a846e9b — pre-configured

In sandbox mode, no provider credentials need to be configured in the dashboard — built-in test credentials are used automatically.


Running the Tests


License

MIT


All versions of sdk with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
ext-curl Version *
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package paybridge-np/sdk contains the following files

Loading the files please wait ...