Download the PHP package openpay/sdk without Composer

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

Openpay PHP

PHP client for Openpay API services (version 3.0.0)

This is a client implementing the payment services for Openpay at openpay.mx

Compatibility

PHP 5.2 or later

Requirements

PHP 5.2 or later cURL extension for PHP JSON extension for PHP Multibyte String extension for PHP

Installation

Agregar en la documentación lo siguiente:

Composer

The preferred method is via composer. Follow the installation instructions if you do not already have composer installed.

Once composer is installed, execute the following command in your project root to install this library:

Finally, be sure to include the autoloader:

Manual installation

To install, just:

NOTE: In the example above, the library is located in the directory named Openpay, located inside the same directory that the PHP file which is including the cliente. Make sure to adjust the paths inside your project, otherwise the library will not work.

Implementation

Configuration

Before use the library will be necessary to set up your Merchant ID and Private key. There are three options:

NOTE: please, refer to PHP documentation for further information about this method.

Sandbox/Production Mode

By convenience and security, the sandbox mode is activated by default in the client library. This allows you to test your own code when implementing Openpay, before charging any credit card in production environment. Once you have finished your integration, use the method OpenPay::setProductionMode(FLAG) which will allow you to active/inactivate the sandbox mode.

` Also you can use environment variables for this purpose:

If its necessary, you can use the method Openpay::getProductionMode() to determine anytime, which is the sandbox mode status:

``

PHP client library intro

Once configured the library, you can use it to interact with Openpay API services. The first step is get an instance with the generator:

``

In this example $openpay will be an instance of a merchant (root), wich will be used to call any derived child resource. According to the current version of the Openpay API, these resources are:

You can access all of these resources as public variables of the root instance, so, if you want to add a new customer you will be able to do it as follows:

``

Every call to any resource will return an instance of that resource. In the example above, calling the method add() in the resource customers will return an instance of Customer, calling the method add() in the resource cards will return an instance of Card, and so on. The only exception occurs when you retrieve a list of resources using the method getList(), in which case an array of instances will be returned:

`

On the other hand, the resources derived from Customer, according to Openpay API documentation, are:

Parameters

Those methods which receive more than one parameter (for example, when trying to add a new customer or a new customer's card), must be passed as associatives arrays:

``

NOTE: Please refer to Openpay API docuemntation to determine wich parameters are accepted, wich required and which of those are optional, in every case.

Error handling

The Openpay API generates several types of errors depending on the situation, to handle this, the PHP client has implemented five type of exceptions:

All these error exceptions make available all the information returned by the Openpay API, with the following methods:

The following is an more complete example of error catching:

``

Examples

Customers

Add a new customer to a merchant: ``

Get a customer: ``

Get the list of customers: ``

Update a customer: ``

Delete a customer: ``

Cards

On a merchant:

Add a card: ``

Get a card: ``

Get the list of cards: ``

Delete a card: ``

On a customer:

Add a card: ``

Get a card: ``

Get the list of cards: ``

Delete a card ``

Bank Accounts

Add a bank account to a customer: ``

Get a banck account ``

Get the list of bank accounts: ``

Delete a bank account: ``

Charges

On a Merchant:

Make a charge on a merchant: ``

Get a charge: ``

Get list of charges: ``

Make a capture: ``

Make a refund: ``

On a Customer:

Make a charge on a customer: ``

Get a charge: ``

Get list of charges: ``

Make a capture: ``

Make a refund: ``

Transfers

Make a transfer: ``

Get a transfer: ``

Get list of transfers: ``

Payouts

On a Merchant:

Make a payout on a merchant: ``

Get a payout: ``

Get list of payouts: ``

On a Customer:

Make a payout on a customer: ``

Get a payout: ``

Get list pf payouts: ``

Fees

Make a fee charge ``

Get list of fees charged: ``

Plans

Add a plan: ``

Get a plan: ``

Get list of plans: ``

Update a plan: ``

Delete a plan: ``

Get list of subscriptors of a plan: ``

Subscriptions

Add a subscription: `` See documetation for more detail, creating subscriptions.

Get a subscription: ``

Get list of subscriptions: ``

Update a subscription: ``

Delete a subscription: ``


All versions of sdk with dependencies

PHP Build Version
Package Version
Requires php Version >=5.2.1
ext-curl Version *
ext-hash 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 openpay/sdk contains the following files

Loading the files please wait ....