1. Go to this page and download the library: Download vragovr/safecrow-api 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/ */
vragovr / safecrow-api example snippets
$config = new \SafeCrow\Config('key', 'secret');
$client = new \SafeCrow\Client();
$client->authenticate($config);
# Add user
$user = $client->getUserApi()->add([
'name' => 'Ivan Ivanov',
'phone' => '79009996666',
'email' => '[email protected]',
]);
# Edit user
$user = $client->getUserApi()->edit([
'name' => 'Ivan Ivanov',
'phone' => '79009996666',
'email' => '[email protected]',
]);
# All users
$users = $client->getUserApi()->all();
# Show user
$user = $client->getUserApi()->show(1);
# All user orders
$orders = $client->getUserApi()->orders(1);
# Bind user card
$url = $client->getUserApi()->bind(1, [
'callback_url' => 'https://example.org/success-card',
]);
# All users cards
$cards = $client->getUserApi()->cards([
'all' => true,
]);
# Add order
$order = $client->getOrderApi()->add([
'consumer_id' => 1,
'supplier_id' => 2,
'price' => 10000,
'description' => 'description...',
'service_cost_payer' => Order::PAYER_HALF, // or Order::PAYER_CONSUMER or Order::PAYER_SUPPLIER
]);
# All order
$orders = $client->getOrderApi()->all();
# Show order
$order = $client->getOrderApi()->show(1);
# Pay order
$url = $client->getOrderApi()->pay([
'callback_url' => 'https://example.org/success-order',
]);
# Annul order
$order = $client->getOrderApi()->annul([
'reason' => 'reason...',
]);
# Cancel order
$order = $client->getOrderApi()->cancel([
'reason' => 'reason...',
]);
# Close order
$order = $client->getOrderApi()->close(1, [
'reason' => 'reason...',
]);
# Escalate order
$order = $client->getOrderApi()->escalate(1, [
'reason' => 'reason...',
]);
# Bind card to order
$order = $client->getOrderApi()->bind(1, 1, [
'supplier_payout_card_id' => 1,
]);