Download the PHP package wpzinc/airwallex-php without Composer

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

Airwallex PHP SDK

An unofficial PHP library for the Airwallex API, modelled on Stripe's PHP SDK.

This package is not affiliated with or endorsed by Airwallex. "Airwallex" is a trademark of Airwallex Pty Ltd, used here only to describe API compatibility.

Requirements

PHP 8.2 or later.

Installation

Getting started

Create an API key in the Airwallex web app under Developer > API keys.

Services are properties on the client. Resources from the core payments and treasury APIs live at the top level. Other products are grouped by namespace, as in Stripe's SDK:

Every method takes path parameters first, then $params (query string for GET, JSON body otherwise) and $opts (request options). See docs/SERVICES.md for the full list.

Billing (subscriptions)

Field names follow the Airwallex API reference. The SDK passes $params through unchanged, so check the docs for each endpoint's fields.

Pagination

List methods return a Collection. Iterate the current page, or use autoPagingIterator() to walk every page lazily. Both of Airwallex's pagination styles are handled: page_num with has_more, and the page cursor with page_after / page_before.

Endpoints that return a bare JSON array, such as balances->current(), also come back as a Collection.

Request options

Idempotency

Airwallex uses a request_id body field as its idempotency key. The SDK adds a random UUID on the endpoints that accept one, and reuses it when it retries. Pass your own to make retries across processes safe:

Airwallex doesn't replay a reused request_id. It rejects it with duplicate_request, which the SDK throws as IdempotencyException. If you get one after a timeout or retry, the original request almost certainly succeeded, so look the resource up (e.g. by merchant_order_id) rather than creating it again.

Set 'auto_request_id' => false in the config to turn this off.

Errors

API errors throw a subclass of WPZinc\Airwallex\Exception\ApiErrorException:

Exception Status
InvalidRequestException 400
AuthenticationException 401
PermissionException 403, or 401 "Insufficient permissions" (scoped key missing a permission)
NotFoundException 404
IdempotencyException 400 duplicate_request (extends InvalidRequestException)
ConflictException 409
RateLimitException 429
ServerException 5xx
UnknownApiErrorException other

Network failures throw ApiConnectionException. Every SDK exception implements ExceptionInterface.

Webhooks

Airwallex signs each delivery with HMAC-SHA256 over the x-timestamp header followed by the raw body. Verify it before trusting the event:

Webhook::constructEventFromHeaders($payload, $headers, $secret) reads the headers from an array instead (e.g. getallheaders() or a PSR-7 request). Timestamps older than 5 minutes are rejected; pass a different tolerance in seconds, or null to skip the check.

Manage webhook endpoints with $airwallex->webhooks.

Files

Uploads go to Airwallex's separate files host:

Configuration

Option Default Description
client_id, api_key Your credentials
access_token Use an existing bearer token (e.g. from the Partner API OAuth flow) instead of logging in
environment production production or sandbox
api_version AirwallexClient::API_VERSION Sent as x-api-version. Set to null to use your account's default
login_as x-login-as account ID, for scoped keys linked to several accounts
on_behalf_of Default x-on-behalf-of connected account ID
max_network_retries 2 Retries for connection errors, 429 and 5xx
timeout 80 Request timeout in seconds
auto_request_id true Add request_id automatically where needed
http_client CurlClient Any HttpClient\ClientInterface implementation
token_store InMemoryTokenStore Any Auth\TokenStoreInterface implementation
base_url, files_base_url Override the API hosts

Caching access tokens

Access tokens last 30 minutes. The default store only keeps them for the current PHP process, so a web app would otherwise log in on every request. Implement TokenStoreInterface against your cache to share tokens:

Custom HTTP client

Implement WPZinc\Airwallex\HttpClient\ClientInterface (one request() method) to send requests through Guzzle, Laravel's HTTP client, or a mock in your tests.

Endpoints the SDK doesn't wrap yet

Development

Sandbox tests

tests/Sandbox runs real requests against the Airwallex sandbox: payments, billing checkout, pagination, webhooks, file uploads and errors. Create a scoped sandbox API key, then add a .env (git-ignored):

The default composer test only runs the offline unit suite.

The service classes, resource classes and codegen/README.md.

Roadmap

License

MIT


All versions of airwallex-php with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
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 wpzinc/airwallex-php contains the following files

Loading the files please wait ...