Download the PHP package ether/web-payments without Composer

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

Web Payments for Craft Commerce

Use the Web Payments API and Apply & Google Pay to vastly improve your checkout process!

Usage

Setup

After installing the plugin:

  1. Create a Stripe payment gateway.
  2. Select the gateway in the plugin options.
  3. Register your domain with Stripe and Apple Pay (Simply add your domain here).
  4. Output the button where ever you want using the template tag below.
  5. ???
  6. Profit.

{{ craft.webPayments.button(options) }}

Place this twig where you want the payments button to appear.

Options

Pass a twig object as the only parameter to configure the button.

items

An array of items to buy. Use this OR cart.

items[x].id

The ID of the purchasable.

items[x].qty

The Qty being purchased.

cart

A Craft Commerce Order (i.e. the current cart). Use this OR items.

requestShipping

A boolean or string. If true a shipping address will be required. Can also be set to one of: 'shipping', 'delivery', 'pickup', true, false (default). This will also change how the UI refers to the shipping of the products. For example, in English speaking countries you would say "pizza delivery" not "pizza shipping". Setting this to true will default the working to "shipping".

requestDetails

An array of additional details to request. Any of: name, email (email is always collected, so you don't need to add it), phone.

onComplete

An object of events to trigger once the payment is complete.

onComplete.redirect

A URL to redirect to once the payment is completed. Can include {number}, which will output the order number.

onComplete.js

JavaScript that will be executed once the payment is complete. Has access to the cwp object. Currently this only has cwp.number (the order number).

js

The variable the button will be set to in JS. Useful if you want to dynamically update the items in the virtual cart.

style

Customize the appearance of the button:

Example

Dynamic Updating

You can dynamically update the button via JS.

Use the js option to define the variable you want the button to be bound to:

You can then get the current items and update them:

You can't update the items directly (i.e. window.payButton.items[0].id = 2). The items are immutable, and therefore must be set to a new array if you want to update them. Above we are cloning the existing items into a new array before modifying them.

If you passed in a cart you can simply call refresh() to update the button with the latest contents of the cart.

Note that you can't update the button while the payment dialog is active.

If you need to reload the button (i.e. if the DOM has changed) you can use the reload() function.

reload() will return a new instance of the button, so you'll want to replace your existing variable with that new instance.

TODO


All versions of web-payments with dependencies

PHP Build Version
Package Version
Requires craftcms/cms Version ^4.0.0
craftcms/commerce Version ^4.0.0
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 ether/web-payments contains the following files

Loading the files please wait ....