user1978550
user1978550

Reputation:

Creating a recurring billing profile for Authorize.net (PHP or XML)

I can't seem to find any clear information explaining the differences in ways to create a subscription. I see there is the PHP API on github, and there is also a POST endpoint -- which I believe is where you submit XML? Why would I go through downloading everything through Composer when I can just post using XML?

There isn't as much documentation on the XML way, and their API documentation gives the impression that they want you to use the github library, but it also supplies the POST endpoints. Is the endpoint way getting phased out? I started developing what I needed using the github API, but now I'm thinking the XML might be easier, but I can only find unofficial libraries and documentation on how to set up an ARB via XML.

What am I missing here?

Upvotes: 1

Views: 168

Answers (2)

Nexus Software Systems
Nexus Software Systems

Reputation: 353

The Software Development Kits on Github just make it easier for some to get up and running quicker. They in fact use the same endpoints, you would use when submitting your own XML payload.

Basically, to use the XML method you would create the following XML and post to one of the API endpoints below:

Sandbox URL: https://apitest.authorize.net/xml/v1/request.api

Production URL: https://api.authorize.net/xml/v1/request.api

For example to create a new Subscription, you would post the XML below to the appropriate endpoint:

<?xml version="1.0" encoding="utf-8"?>
<ARBCreateSubscriptionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
    <merchantAuthentication>
        <name>Your API Login ID</name>
        <transactionKey>Your transactionKey</transactionKey>
    </merchantAuthentication>
    <refId>Sample</refId>
    <subscription>
        <name>Sample subscription</name>
        <paymentSchedule>
            <interval>
                <length>1</length>
                <unit>months</unit>
            </interval>
            <startDate>2020-08-30</startDate>
            <totalOccurrences>12</totalOccurrences>
            <trialOccurrences>1</trialOccurrences>
        </paymentSchedule>
        <amount>10.29</amount>
        <trialAmount>0.00</trialAmount>
        <payment>
            <creditCard>
                <cardNumber>4111111111111111</cardNumber>
                <expirationDate>2020-12</expirationDate>
            </creditCard>
        </payment>
        <billTo>
            <firstName>John</firstName>
            <lastName>Smith</lastName>
        </billTo>
    </subscription>
</ARBCreateSubscriptionRequest>

Upvotes: 0

rhldr
rhldr

Reputation: 1069

Your options include using the API with XML or using the PHP SDK from GitHub.

Upvotes: 0

Related Questions