PHP code example of wdevkit / sdk
1. Go to this page and download the library: Download wdevkit/sdk 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/ */
wdevkit / sdk example snippets
$accounts = \Wdevkit\Sdk\Api::auth($settings);
$payments = \Wdevkit\Sdk\Api::payments($settings);
$checkout = \Wdevkit\Sdk\Api::checkout($settings);
$orders = \Wdevkit\Sdk\Api::orders($settings);
$inventory = \Wdevkit\Sdk\Api::inventory($settings);
'headers' => [
'User-Agent' => 'wdevkit/sdk:1.x',
'Accept' => 'application/json',
'Content-Type' => 'application/json',
'Authorization' => 'Bearer ' . <token>,
]
$settings = [
'base_uri' => 'https://payments.your_domain.dev',
'token' => 'some_token'
];
$methods = \Wdevkit\Sdk\Api::payments($settings)->fetchMethods([]);
// response
'data' => [
'methods' => [
['code' => 'credit_card', 'title' => 'Credit Card', 'driver' => 'stripe'],
['code' => 'transfer', 'title' => 'Transfer', 'driver' => 'bank_acme'],
]
]
$settings = [
'base_uri' => 'https://payments.your_domain.dev',
'token' => 'some_token'
];
$methods = \Wdevkit\Sdk\Api::payments($settings)->create([
'customer' => [
'name' => 'John Doe', // 'installments' => 1, //
'payment_uuid' => 'fb624d85-5a13-47c7-8ea7-b917490d5e12',
'payment_method' => 'credit_card',
'amount' => '42',
'state' => 'processed',
'status' => 'success',
'errors' => null,
'actions' => [
['title' => 'Refund', 'code' => 'refund', 'url' => 'https://refund_route'],
['title' => 'Details', 'code' => 'details', 'url' => 'https://details_route'],
],
]
$settings = [
'base_uri' => 'https://payments.your_domain.dev',
'token' => 'some_token'
];
$methods = \Wdevkit\Sdk\Api::payments($settings)->fetch('fb624d85-5a13-47c7-8ea7-b917490d5e12');
// response
'data' => [
'id' => 50,
'uuid' => 'fb624d85-5a13-47c7-8ea7-b917490d5e12',
'driver' => 'acme',
'method' => 'credit_card',
'state' => 'processed',
'status' => 'success',
'amount' => '119.0000',
'installments' => 1,
'description' => 'test payment',
'recurring' => null,
'customer' => [
'name' => 'John Doe',
'email' => '[email protected] ',
'phone' => '999999999',
'document' => '999999999999'
]
]