1. Go to this page and download the library: Download plutopay/plutopay-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/ */
plutopay / plutopay-php example snippets
use PlutoPay\Client;
use PlutoPay\Model\CreateTransactionRequest;
$pluto = new Client(getenv('PLUTOPAY_SECRET_KEY'));
$txn = $pluto->transactions->createPayment(
new CreateTransactionRequest([
'amount' => 4750, // $47.50 in cents
'currency' => 'usd',
'payment_method_type' => 'card',
'description' => 'Order #1001',
]),
'order_1001' // Idempotency-Key
);
echo $txn->getData()->getId();
echo $txn->getClientSecret(); // confirm client-side with the Payment Element
use PlutoPay\Model\{CreateTerminalPaymentRequest, ProcessTerminalPaymentRequest, CancelTransactionRequest};
$created = $pluto->terminal->createTerminalPayment(
new CreateTerminalPaymentRequest(['amount' => 4750, 'metadata' => ['order_id' => '1001']]),
'order_1001' // Idempotency-Key — a retry returns the same payment
)->getData();
$pluto->terminal->processTerminalPayment(new ProcessTerminalPaymentRequest([
'payment_intent_id' => $created->getPaymentIntentId(),
'reader_id' => 'tmr_…', // from $pluto->terminal->listTerminals()
]));
// Customer walked away: reset the reader AND cancel the intent in one call.
$pluto->transactions->cancelTransaction($created->getId(), new CancelTransactionRequest(['reason' => 'abandoned']));
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.