PHP code example of nuvocode / nuvo-payment-sdk

1. Go to this page and download the library: Download nuvocode/nuvo-payment-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/ */

    

nuvocode / nuvo-payment-sdk example snippets


use NuvoPayment\NuvoPayment;

$nuvo = new NuvoPayment();

// Create a payment
$payment = $nuvo->payments->create(49.99, 'USD', [
    'success' => 'https://example.com/success',
    'cancel' => 'https://example.com/cancel'
]);

if (!isset($payment['error'])) {
    header('Location: ' . $payment['redirect_url']);
} else {
    echo "Error: " . $payment['message'];
}

// Get payment status
$status = $nuvo->payments->find('pay_123');

$payment = $nuvo->payments->create(
    49.99,
    'USD',
    [
        'success' => 'https://example.com/success',
        'cancel' => 'https://example.com/cancel'
    ],
    ['order_id' => 'ORD-12345']
);

$status = $nuvo->payments->find('pay_123');

[
    'status' => 'success',
    'payment_id' => 'pay_123',
    'redirect_url' => 'https://checkout.stripe.com/...',
    'provider' => 'stripe'
]

[
    'error' => true,
    'status' => 401,
    'message' => 'Unauthorized'
]