Download the PHP package quellabs/canvas-payments-contracts without Composer

On this page you can find all versions of the php package quellabs/canvas-payments-contracts. 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 canvas-payments-contracts

Canvas Payments Contracts

Shared contracts for the Canvas payments ecosystem. Contains the interfaces and value objects that connect payment provider packages to your application.

Installation

What's in this package

Class / Interface Description
PaymentInterface Interface for application code — exposes initiate, refund, getRefunds, getPaymentOptions
PaymentProviderInterface Interface all driver packages must implement — extends PaymentInterface, adds discovery methods
PaymentRequest Input for initiating a payment
InitiateResult Result of a successful payment initiation
PaymentState Payment snapshot delivered via the payment_exchange signal
PaymentStatus Enum of possible payment states
RefundRequest Input for issuing a refund
RefundResult Result of a successful refund
PaymentAddress Billing or shipping address attached to a payment
PaymentException Base exception for all payment failures
PaymentInitiationException Thrown when initiate() fails
PaymentRefundException Thrown when refund() or getRefunds() fails
PaymentExchangeException Thrown internally by the controller layer

All amounts are in minor units (e.g. 999 for €9.99). All classes are in the Quellabs\Payments\Contracts namespace.

Usage

PaymentState

PaymentState is an immutable snapshot of a payment's current status. Your application receives it by subscribing to the payment_exchange signal, which is emitted by the controller layer after a return URL visit or webhook.

Property Type Description
$provider string Provider identifier, e.g. 'mollie', 'paypal'
$transactionId string Provider's unique identifier for this payment
$state PaymentStatus Normalised payment status
$currency string ISO 4217 currency code, e.g. 'EUR'
$valuePaid int Amount actually captured, in minor units. 0 if not yet paid
$valueRefunded int Total amount refunded so far, in minor units
$internalState ?string Raw status string from the provider, before normalisation
$metadata array Provider-specific data, e.g. captureId required for refunds

$valuePaid is only non-zero when $state is PaymentStatus::Paid or PaymentStatus::Refunded. For all other states — including Pending — it is 0. Use $state to determine whether funds have actually moved, and $valuePaid to know how much.

To issue a refund after a successful payment, persist $metadata['paymentReference'] from the PaymentState — it is required as RefundRequest::$paymentReference.

Exceptions

All exceptions extend PaymentException, which exposes getProvider(): string and getErrorId(): int. Catch the base class to handle any payment failure, or catch a specific subclass to handle a particular operation.

PaymentStatus values

Case Description
PaymentStatus::Pending Payment is open or pending
PaymentStatus::Paid Payment completed successfully
PaymentStatus::Canceled Customer canceled — definitive
PaymentStatus::Expired Customer abandoned, or bank transfer timed out
PaymentStatus::Failed Payment failed and cannot be retried
PaymentStatus::Refunded Payment was refunded
PaymentStatus::Redirect Redirect user back to provider. Internally handled.
PaymentStatus::Unknown Unrecognised status from provider

License

MIT


All versions of canvas-payments-contracts with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
quellabs/contracts 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 quellabs/canvas-payments-contracts contains the following files

Loading the files please wait ...