Giter Site home page Giter Site logo

conekta-php's Introduction

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": "dev-master"

Simple usage looks like:

Conekta::setApiKey('qso7o4nDGnWNMESzLxq4');
$myCard = array('number' => '4242424242424242', 'exp_month' => 5, 'exp_year' => 2015, 'cvc' => 123, 'name' => 'Mario Moreno');
try {
  $charge = Conekta_Charge::create(array('card' => $myCard, 'description' => 'Some desc', 'amount' => 2000, 'currency' => 'mxn'));
  echo $charge;
} catch (Exception $e) {
  // Catch all exceptions including validation errors.
  echo $e->getMessage(); }

{
    "id": "5286828b8ee31e64b7001739",
    "livemode": false,
    "created_at": 1384546955,
    "status": "paid",
    "currency": "MXN",
    "description": "Some desc",
    "reference_id": null,
    "failure_code": null,
    "failure_message": null,
    "object": "charge",
    "amount": 2000,
    "fee": 371,
    "payment_method": {
        "name": "Mario Moreno",
        "exp_month": "05",
        "exp_year": "15",
        "auth_code": "861491",
        "object": "card_payment",
        "last4": "4242",
        "brand": "visa"
    },
    "details": {
        "name": null,
        "phone": null,
        "email": null,
        "line_items": []
    }
}

Documentation

Please see www.conekta.io/docs/api for up-to-date documentation.

Tests

In order to run tests you have to install SimpleTest (packagist.org/packages/vierbergenlars/simpletest) via Composer (getcomposer.org/) (recommended way):

composer.phar update --dev

Run test suite:

php ./test/Conekta.php

conekta-php's People

Contributors

danschultzer avatar leofischer avatar mauriciomurga avatar

Watchers

 avatar  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.