PHP code example of vnpost / postpay-php
1. Go to this page and download the library: Download vnpost/postpay-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/ */
vnpost / postpay-php example snippets
bash
composer
bash
use Postpay\PostpayClient;
class PostpayController extends Controller
{
public function createAccount(PostpayClient $postpayClient)
{
$data = input('post.'); // Thay chỗ này phù hợp với từng Framework
$response = $postpayClient->createAccount($data);
if ($response->getErrorCode()) {
return json(['error' => $response->getErrorMessage()], 400);
}
return json($response->getData());
}
}