Code Monkey home page Code Monkey logo

conekta-php's Introduction

README Cover Image

Conekta PHP v.4.0.0

This is a php library that allows interaction with https://api.conekta.io API.

Installation

Obtain the latest version of the Conekta PHP bindings with:

git clone https://github.com/conekta/conekta-php

To get started, add the following to your PHP script:

require_once("/path/to/conekta-php/lib/Conekta.php");

You can also install this library with composer:

require: "conekta/conekta-php": "4.0.0"

Usage

setApiKey();
$valid_order =
    array(
        'line_items'=> array(
            array(
                'name'        => 'Box of Cohiba S1s',
                'description' => 'Imported From Mex.',
                'unit_price'  => 20000,
                'quantity'    => 1,
                'sku'         => 'cohb_s1',
                'category'    => 'food',
                'tags'        => array('food', 'mexican food')
                )
           ),
          'currency'    => 'mxn',
          'metadata'    => array('test' => 'extra info'),
          'charges'     => array(
              array(
                  'payment_source' => array(
                      'type'       => 'oxxo_cash',
                      'expires_at' => strtotime(date("Y-m-d H:i:s")) + "36000"
                   ),
                   'amount' => 20000
                )
            ),
            'currency'      => 'mxn',
            'customer_info' => array(
                'name'  => 'John Constantine',
                'phone' => '+5213353319758',
                'email' => '[email protected]'
            )
        );

try {
  $order = \Conekta\Order::create($valid_order);
} catch (\Conekta\ProcessingError $e){ 
  echo $e->getMessage();
} catch (\Conekta\ParameterValidationError $e){
  echo $e->getMessage();
} finally (\Conekta\Handler $e){
  echo $e->getMessage();
}

Documentation

Please see developers.conekta.com/api for up-to-date documentation.

Run Tests

Unit test based on php library PHPUnit to describe better memory usage, test status and test results.

Requeriments

PHPUnit 6.1 requires PHP 7; using the latest version of PHP is highly recommended.

Installation

for better usage install phpunit globally

$ wget https://phar.phpunit.de/phpunit-6.1.phar

$ chmod +x phpunit-6.1.phar

$ sudo mv phpunit-6.1.phar /usr/local/bin/phpunit

$ phpunit --version

ej. output
PHPUnit 6.1.1 by Sebastian Bergmann and contributors.

php version used

PHP 7.0.17 (cli)

Run test suite:

phpunit test/Conekta-x.0

note: for this phpunit version (6.1.x) only php 7 is supported for older php versions see phpunit documentation

License

Developed in Mexico by Conekta. Available with MIT License.


We are always hiring!

If you are a comfortable working with a range of backend languages (Java, Python, Ruby, PHP, etc) and frameworks, you have solid foundation in data structures, algorithms and software design with strong analytical and debugging skills. Send your CV, github to [email protected]

conekta-php's People

Contributors

mauriciomurga avatar andreasantillana avatar luiscarlos-gonzalez avatar joecohens avatar jovalo avatar janee avatar leofischer avatar richpeniche avatar picharras avatar adrian0350 avatar javiermurillo avatar julsdelatierra avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.