PHP code example of oderopay / odero-php

1. Go to this page and download the library: Download oderopay/odero-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

oderopay / odero-php example snippets


$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('[email protected]')
    ->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);

`bash 
composer 
`bash