1. Go to this page and download the library: Download geekwalletsrl/arnipay-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/ */
use Arnipay\Gateway\Client;
use Arnipay\Gateway\PaymentLink;
use Arnipay\Gateway\Webhook;
use Arnipay\Gateway\Transaction;
// Initialize the client
$client = new Client(
'your-client-id',
'your-private-key'
);
// For sandbox:
// $client->setBaseUrl('https://sandbox.arnipay.com.py/api/v1', false);
// For local development:
// $client->setBaseUrl('http://arnipay.local/api/v1', false);
$paymentLink = new PaymentLink($client);
try {
$link = $paymentLink->create(
150000, // price
'Premium Subscription', // title
'1 year access to all premium content', // description
[
'payment_methods' => ['qr', 'tigo'],
'reference' => 'SUB-' . date('Y'),
'approved_redirection_url' => 'https://example.com/success',
'failed_redirection_url' => 'https://example.com/failed'
]
);
echo "Payment link created with ID: " . $link['id'] . "\n";
echo "Payment URL: " . $link['url'] . "\n";
} catch (Arnipay\Exception\GatewayException $e) {
echo "Error: " . $e->getMessage() . "\n";
if ($errors = $e->getErrors()) {
print_r($errors);
}
}