This is a PHP library that allows interaction with Conekta's API.
PHPUnit ~8 requires PHP 8.0+; using the latest version of PHP is highly recommended.
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": "5.0.1"
setApiKey();
$valid_order =
[
'line_items'=> [
[
'name' => 'Box of Cohiba S1s',
'description' => 'Imported From Mex.',
'unit_price' => 20000,
'quantity' => 1,
'sku' => 'cohb_s1',
'category' => 'food',
'tags' => ['food', 'mexican food']
]
],
'currency' => 'mxn',
'metadata' => ['test' => 'extra info'],
'charges' => [
[
'payment_method' => [
'type' => 'oxxo_cash',
'expires_at' => strtotime(date("Y-m-d H:i:s")) + "36000"
],
'amount' => 20000,
]
],
'currency' => 'mxn',
'customer_info' => [
'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();
}
Please visit the official API reference for an up-to-date documentation.
Unit test based on PHP library PHPUnit to describe better memory usage, test status and test results.
For better usage install PHPUnit globally:
$ wget https://phar.phpunit.de/phpunit-8.5.2.phar
$ chmod +x phpunit-8.5.2.phar
$ sudo mv phpunit-8.5.2.phar /usr/local/bin/phpunit
$ phpunit --version
ej. output
PHPUnit 8.5.2 by Sebastian Bergmann and contributors.
PHP version used
PHP 8.0 (cli)
Run test suite:
phpunit test/Conekta-x.0
note: for this PHPUnit version (8.x) only PHP 8.0+ is supported for older PHP versions see PHPunit documentation
Please see CHANGELOG for more information what has changed recently.
-
Fork the repository
-
Clone the repository
git clone [email protected]:yourUserName/conekta-php.git
- Create a branch
git checkout develop
git pull origin develop
# You should choose the name of your branch
git checkout -b <feature/my_branch>
- Make necessary changes and commit those changes
git add .
git commit -m "my changes"
- Push changes to GitHub
git push origin <feature/my_branch>
-
Submit your changes for review, create a pull request
To create a pull request, you need to have made your code changes on a separate branch. This branch should be named like this: feature/my_feature or fix/my_fix.
Make sure that, if you add new features to our library, be sure to add the corresponding unit tests.
If you go to your repository on GitHub, you’ll see a Compare & pull request button. Click on that button.
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, check our open positions: https://www.conekta.com/careers
Developed in 🇲🇽 Mexico by Conekta. Available with MIT License.