Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/290.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用php授权.net集成_Php_Authorize.net_Recurring Billing_Authorize.net Arb - Fatal编程技术网

使用php授权.net集成

使用php授权.net集成,php,authorize.net,recurring-billing,authorize.net-arb,Php,Authorize.net,Recurring Billing,Authorize.net Arb,我们使用authorize.net实现ARB订阅。已成功完成订阅创建。但是如何使用php从authorize.net使用订阅id获取订阅状态。因为我们每天都会在网站上更新过期用户的状态详情。让我知道还有其他方法吗?您可以使用ARB API中的ARBGetSubscriptionStatusRequest来获取订阅的状态。如果您使用*号,它将如下所示: <?php /***************************************************************

我们使用authorize.net实现ARB订阅。已成功完成订阅创建。但是如何使用php从authorize.net使用订阅id获取订阅状态。因为我们每天都会在网站上更新过期用户的状态详情。让我知道还有其他方法吗?

您可以使用ARB API中的
ARBGetSubscriptionStatusRequest
来获取订阅的状态。如果您使用*号,它将如下所示:

<?php
/*************************************************************************************************

Use the ARB XML API to create get a subscription's status

SAMPLE XML FOR API CALL
--------------------------------------------------------------------------------------------------
<?xml version="1.0"?>
<ARBGetSubscriptionStatusRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
  <merchantAuthentication>
    <name>yourloginid</name>
    <transactionKey>yourtransactionkey</transactionKey>
  </merchantAuthentication>
  <refId>Sample</refId>
  <subscriptionId>1207505</subscriptionId>
</ARBGetSubscriptionStatusRequest>

SAMPLE XML RESPONSE
--------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<ARBGetSubscriptionStatusResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
  <refId>Sample</refId>
  <messages>
    <resultCode>Ok</resultCode>
    <message>
      <code>I00001</code>
      <text>Successful.</text>
    </message>
  </messages>
  <status>active</status>
</ARBGetSubscriptionStatusResponse>

*************************************************************************************************/

    require('../../config.inc.php');
    require('../../AuthnetXML.class.php');

    $xml = new AuthnetXML(AUTHNET_LOGIN, AUTHNET_TRANSKEY, AuthnetXML::USE_DEVELOPMENT_SERVER);
    $xml->ARBGetSubscriptionStatusRequest(array(
        'refId' => 'Sample',
        'subscriptionId' => '1207505'
    ));
?>

<!DOCTYPE html>
<html>
<html lang="en">
    <head>
        <title></title>
        <style type="text/css">
            table
            {
                border: 1px solid #cccccc;
                margin: auto;
                border-collapse: collapse;
                max-width: 90%;
            }

            table td
            {
                padding: 3px 5px;
                vertical-align: top;
                border-top: 1px solid #cccccc;
            }

            pre
            {
                overflow-x: auto; /* Use horizontal scroller if needed; for Firefox 2, not needed in Firefox 3 */
                white-space: pre-wrap; /* css-3 */
                white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
                white-space: -pre-wrap; /* Opera 4-6 */
                white-space: -o-pre-wrap; /* Opera 7 */ /*
                width: 99%; */
                word-wrap: break-word; /* Internet Explorer 5.5+ */
            }

            table th
            {
                background: #e5e5e5;
                color: #666666;
            }

            h1, h2
            {
                text-align: center;
            }
        </style>
    </head>
    <body>
        <h1>
            ARB :: Get Subscription Status
        </h1>
        <h2>
            Results
        </h2>
        <table>
            <tr>
                <th>Response</th>
                <td><?php echo $xml->messages->resultCode; ?></td>
            </tr>
            <tr>
                <th>code</th>
                <td><?php echo $xml->messages->message->code; ?></td>
            </tr>
            <tr>
                <th>Successful?</th>
                <td><?php echo ($xml->isSuccessful()) ? 'yes' : 'no'; ?></td>
            </tr>
            <tr>
                <th>Error?</th>
                <td><?php echo ($xml->isError()) ? 'yes' : 'no'; ?></td>
            </tr>
            <tr>
                <th>status</th>
                <td><?php echo $xml->status; ?></td>
            </tr>
        </table>
        <h2>
            Raw Input/Output
        </h2>
<?php
    echo $xml;
?>
    </body>
</html>

*我是该代码的作者

好的,谢谢你的回复。使用此文件,我将每天使用cron检查每个用户的状态,并在我的网站中更新订阅。