Informacija Atsiprašome, šis skyrius galimas tik anglų kalba.
Earn with Paysera

Do you create a libraries?

We will pay from 100 to 200 EUR for an accurate and working programming code. If you’d like to cooperate in the future and receive orders for maintenance of a specific system version, the code and your contact data will be published for open use.

Contact us via email to support@paysera.com

You can integrate Paysera system into your website by downloading our open source software library lib_deliver_api. The library can be used to check all the necessary security parameters of transferred and received data.

  • lib-delivery-api-merchant-client for PHP from GitHub.
    $ git clone https://github.com/paysera/lib-delivery-api-merchant-client

Library usage

This library provides ClientFactory class, which you should use to get the API client itself:

use Paysera\DeliveryApi\MerchantClient\ClientFactory;

$clientFactory = new ClientFactory([
    'base_url' => 'https://delivery-api.paysera.com/rest/v1/',
    'mac' => [
        'mac_id' => 'project_id',
        'mac_secret' => 'project_password',
    ],
]);

$merchantClient = $clientFactory->getMerchantClient();

Library methods

Now, that you have instance of MerchantClient, you can use following methods:

Get shipment gateways

use Paysera\DeliveryApi\MerchantClient\Entity\GatewaysFilter;

$gatewaysFilter = (new GatewaysFilter())
    ->setProjectId($projectId)
    ->setFromCountryCode($fromCountryCode)
    ->setToCountryCode($toCountryCode)
    ->setShipments($shipments)
    ->setShipmentMethodCode($shipmentMethodCode)
;

$result = $merchantClient->updateGateway($gatewaysFilter);

Create shipping order

use Paysera\DeliveryApi\MerchantClient\Entity\OrderCreate;

$orderCreate = new OrderCreate()
    ->setProjectId($projectId)
    ->setShipmentGatewayCode($shipmentGatewayCode)
    ->setShipmentMethodCode($shipmentMethodCode)
    ->setShipments($shipments)
    ->setSenderId($senderId)
    ->setSender($sender)
    ->setReceiverId($receiverId)
    ->setReceiver($receiver)
    ->setNotes($notes)
;

$result = $merchantClient->createOrder($orderCreate);