1. Go to this page and download the library: Download makstech/montonio-php-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/ */
makstech / montonio-php-sdk example snippets
use Montonio\MontonioClient;
// Initialize the client
$client = new MontonioClient(
$accessKey,
$secretKey,
MontonioClient::ENVIRONMENT_SANDBOX, // or MontonioClient::ENVIRONMENT_LIVE
);
// Get OrdersClient
$ordersClient = $client->orders();
// Create order structure
// This example shows only some setters and options. Check source
// structures for all options and check documentation for eff',
...
],
]);
// ... as this, but fluently
$orderData
->setLocale('en')
->setBillingAddress($address)
->setMerchantReference(uniqid())
->setReturnUrl('https://google.com?q=montonio+return+url')
->setNotificationUrl('https://google.com?q=montonio+notification')
->setGrandTotal(1337)
->setCurrency('EUR')
->setPayment(
$payment = (new \Montonio\Structs\Payment())
->setCurrency('EUR')
->setAmount(1337)
->setMethod(Payment::METHOD_PAYMENT_INITIATION)
)
->addLineItem(
$item1 = (new \Montonio\Structs\LineItem())
->setName('elephant')
->setFinalPrice(668.5)
->setQuantity(2)
)
->setShippingAddress($address)
;
// Send API request
$order = $ordersClient->createOrder($orderData);
// Get payment URL
$paymentUrl = $order['paymentUrl'];
// Redirect customer to that URL
header("Location: $paymentUrl");
shell
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.