1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 01:39:24 +02:00
Oinktube/plugin/YPTWallet/plugins/YPTWalletPayPal/requestPayment.json.php
2020-11-30 16:44:26 -03:00

31 lines
No EOL
899 B
PHP

<?php
header('Content-Type: application/json');
if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = '../../../../';
}
require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php';
$plugin = AVideoPlugin::loadPluginIfEnabled("PayPalYPT");
$pluginS = AVideoPlugin::loadPlugin("YPTWallet");
$objS = $pluginS->getDataObject();
$obj= new stdClass();
$obj->error = true;
if(empty($_POST['value'])){
$obj->msg = "Invalid Value";
die(json_encode($obj));
}
$invoiceNumber = uniqid();
$payment = $plugin->setUpPayment($invoiceNumber, $objS->RedirectURL, $objS->CancelURL, $_POST['value'], $objS->currency, $config->getWebSiteTitle()." Payment");
if (!empty($payment)) {
$obj->error = false;
$obj->approvalLink = $payment->getApprovalLink();
}
die(json_encode($obj));