oderopay / odero-php
Oderopay PHP Sdk
v2.0.0
2024-05-22 08:55 UTC
Requires
- php: ^8.1
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- symfony/http-client: ^6.0
Requires (Dev)
- phpspec/phpspec: ^7.2
- phpspec/prophecy: ^1.15
- symfony/var-dumper: ^5.4
README
The Oderopay PHP library provides convenient access to the Oderopay API from applications written in the PHP language. It includes a pre-defined set of classes for API resources that initialize themselves dynamically from API responses which makes it compatible with Oderopay API.
Requirements
Compatibility
Version | PHP |
---|---|
v1.x |
7.2, 7.3, 7.4 and ^8.0 |
v2.x |
^8.1 |
Installation
You can install the bindings via Composer. Run the following command:
composer require oderopay/odero-php
To use the bindings, use Composer's autoload:
require_once('vendor/autoload.php');
Testing
To run the tests
./vendor/bin/phpspec run
Dependencies
The bindings require the following extensions in order to work properly:
If you use Composer, these dependencies should be handled automatically. If you install manually, you'll want to make sure that these extensions are available.
Getting Started
Simple usage looks like:
$config = new \Oderopay\OderoConfig('My Store Name', '{merchant-id}', '{merchant-token}', \Oderopay\OderoConfig::ENV_STG); $oderopay = new \Oderopay\OderoClient($config); $billingAddress = new \Oderopay\Model\Address\BillingAddress(); $billingAddress ->setAddress('185 Berry St #550, San Francisco, CA 94107, USA') ->setCity('San Francisco') ->setCountry('USA'); $deliveryAddress = new \Oderopay\Model\Address\DeliveryAddress(); $deliveryAddress ->setAddress('185 Berry St #550, San Francisco, CA 94107, USA') ->setCity('San Francisco') ->setCountry('USA') ->setDeliveryType('Courier'); $customer = new \Oderopay\Model\Payment\Customer(); $customer ->setEmail('customer@email.com') ->setPhoneNumber(' +19159969739') ->setDeliveryInformation($deliveryAddress) ->setBillingInformation($billingAddress); $paymentRequest = new \Oderopay\Model\Payment\Payment(); $paymentRequest ->setAmount(100.00) ->setCurrency('USD') ->setExtOrderId('external-random-id') ->setExtOrderUrl('https://mystore.com/sample-product.html') ->setMerchantId('{merchant-id}') ->setCustomer($customer) $payment = $oderopay->payments->create($paymentRequest); var_dump($payment);