Download the PHP package surepay-one/sdk without Composer

On this page you can find all versions of the php package surepay-one/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

surepay-php-sdk

Official PHP client library for the SurePay Merchant API.

CI Packagist

Requirements

Install

Quick start

Configuration

Option Default Description
baseUrl(string) https://api.surepay.one/merchant/v1 Override base URL for local dev or staging
timeout(int) 30 HTTP request timeout in seconds
maxRetries(int) 3 Retry attempts on 5xx and network errors

Authentication

Every request requires an API key sent as an X-API-Key header. When apiSecret is provided to builder(), every outgoing request is automatically signed with HMAC-SHA256 — the X-Signature and X-Timestamp headers are attached with no extra code needed.

API reference

Balance

$client->balance->get()

Get current wallet balance. Requires: balance:read scope.


Deposits

$client->deposits->list(params)

Paginated list of deposit (thu hộ) orders. Requires: deposits:read scope.

$client->deposits->create(req)

Create a new deposit order. Returns a checkoutUrl (redirect) and qrCode (VietQR). Requires: deposits:write scope.

Response fields:

Field Type Description
id string SurePay transaction UUID
requestId string Your order ID
amount int Amount in VND
status string pending, processing, success, failed, expired, cancelled
checkoutUrl string Redirect URL for payer
qrCode string VietQR data string
createdAt string ISO 8601 timestamp
updatedAt string ISO 8601 timestamp

$client->deposits->get(id)

Fetch a single deposit order by UUID. Requires: deposits:read scope.


Payouts

$client->payouts->list(params)

Paginated list of payout (chi hộ) orders. Requires: payouts:read scope.

$client->payouts->create(req)

Initiate a payout bank transfer. Funds are deducted from your wallet immediately on success. Requires: payouts:write scope.

Payouts are irreversible once status moves past pending. Verify bank details with $client->bankInquiry->verify() first.

$client->payouts->get(id)

Fetch a single payout by UUID. Requires: payouts:read scope.


Bank Inquiry

$client->bankInquiry->verify(req)

Look up the account holder name for a bank account. Call this before creating a payout to confirm the recipient. Requires: payouts:read scope.


Idempotency

Pass an idempotency key as the second argument to any create() method. The key is forwarded as an Idempotency-Key header — safe to retry on network errors without risk of duplicate transactions.

Webhook verification

Every inbound webhook event from SurePay is HMAC-signed. Pass the raw request body string (before any JSON parsing) to $client->webhooks->verify():

Or pass the X-Surepay-Signature header value explicitly:

Error handling

Error codes:

HTTP getErrorCode() Meaning
400 validation_error Invalid request body or parameters
401 unauthorized Missing or invalid API key
401 signature_invalid HMAC signature failed or timestamp > 5 min
403 permission_denied API key lacks required scope
403 ip_not_allowed Request IP not in allowlist
404 not_found Resource not found
409 duplicate_request Idempotency key conflict
422 insufficient_balance Top up wallet first
422 invalid_state_transition Operation not allowed for current status
429 rate_limit_exceeded Slow down — back off and retry
500 internal_error Server error

HMAC signing

When apiSecret is set, all requests are signed automatically. The signing algorithm for manual use:

Attach as headers: X-Signature: <signature> and X-Timestamp: <unix_timestamp>.

Signatures expire after 300 seconds — generate per-request, never cache or reuse.

License

MIT


All versions of sdk with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
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 surepay-one/sdk contains the following files

Loading the files please wait ...