conekta/conekta-php

Conekta PHP Library

6.0.11 2024-11-13 14:06 UTC

README

Conekta sdk

For more information, please visit https://github.com/conekta/openapi/issues.

Installation & Usage

Requirements

PHP 7.4 and later. Should also work with PHP 8.0.

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/conekta/conekta-php.git"
    }
  ],
  "require": {
    "conekta/conekta-php": "*@dev"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

<?php
require_once('/path/to/conekta/vendor/autoload.php');

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');

use Conekta\Api\CustomersApi;
use Conekta\ApiException;
use Conekta\Configuration;
use Conekta\Model\Customer;

// Configure authorization
/**
 * @var string $apiKey use private key for authentication
 * @link https://developers.conekta.com/reference/autenticaci%C3%B3n for more information
 */
$apiKey =  getenv("CONEKTA_API_KEY");
$config = Conekta\Configuration::getDefaultConfiguration()->setAccessToken($apiKey);

$apiInstance = new CustomersApi(null, $config);
$rq = new Customer([
    'name' => 'Franklin carrero',
    'email'=> 'mm@gmail.com',
    'phone' => '+5218181818181'
]);
try {
    $result = $apiInstance->createCustomer($rq);
    $json_string = json_encode($result, JSON_PRETTY_PRINT);
    print_r($json_string);
} catch (ApiException $e) {
    echo 'Exception when calling CustomersApi->createCustomer: ', $e->getMessage(), PHP_EOL;
}

API Endpoints

All URIs are relative to https://api.conekta.io

Models

Authorization

Authentication schemes defined for the API:

bearerAuth

  • Type: Bearer authentication

Tests

To run the tests, use:

composer install
vendor/bin/phpunit

Author

engineering@conekta.com

About this package

This PHP package is automatically generated by the OpenAPI Generator project:

  • API version: 2.1.0
    • Package version: 6.0.11
    • Generator version: 7.9.0
  • Build package: org.openapitools.codegen.languages.PhpClientCodegen