Helcim Logo Support & Tutorials

© Copyright 2006-2018 Helcim Inc.

All Rights Reserved.

Helcim Commerce API » Recurring »

Add or Edit a Subscription

This API call let's you add or edit a subscription. The response is an XML of the available subscription information.

Request Fields

Field Name Type Required Description
action String Yes subscriptionEdit
accountId Integer Yes The Helcim Commerce account ID.
apiToken String Yes API token used for authentication and access control. 
subscriptionId String No The subscription ID.  If its present then you are editing a subscription plan.  If it is not present, then you are adding a new subscription plan.
recurringPlanId Integer No The recurring plan ID. If subscriptionId is present then recurringPlanId is optional.  If subscriptionId is not entered then recurringPlanId is required.
customerCode String  No The customer code. If subscriptionId is present then customerCode is optional. If subscriptionId is not entered then customerCode is required.
dateCreated String No The creation date of the subscription.
dateStarted String No The start date of the subscription.
dateRemoved String No The end date of the subscription.
amountRecurring Decimal No The recurring amount.
amountInitial Decimal No The initial amount.
cyclesTotal Integer No The total number of payment cycles.
status Integer No 1 or 0. Whether the subscription is active or not.

Response Fields (XML)

Field Name Type Description
message - XML structure
response Integer 1 or 0. Whether the subscription was added/edited or not.
responseMessage String Confirmation of action taken.
subscription - XML structure
id Integer The subscription ID>
dateCreated String The creation date of the subscription.
dateStarted String  The start date of the subscription.
dateRemoved String The end date of the subscription.
amountInitial Decimal The initial amount.
amountRecurring Decimal The recurring amount.
cyclesBilled Integer The number of billing cycles occured.
cyclesTotal Integer The total number of cycles.

Errors

For all API requests, there are also generic API authentication and user access restriction errors.
Response Code Error Code Message Description
0 - Invalid Subscription ID The subscription ID provided is invalid.
0 - Invalid Recurring Plan ID The plan ID provided was invalid, or not entered.

Code Samples

Sample Subscription Edit Response XML

<message>
    <response>1</response>
    <responseMessage>Subscription Updated</responseMessage>
    <subscription>
        <id>3215</id>
        <dateCreated>2017-04-15 16:33:27</dateCreated>
        <dateStarted>2017-04-15 00:00:00</dateStarted>
        <dateRemoved>0000-00-00 00:00:00</dateRemoved>
        <amountInitial>50.00</amountInitial>
        <amountRecurring>20.00</amountRecurring>
        <cyclesBilled>2</cyclesBilled>
        <cyclesTotal>0</cyclesTotal>
    </subscription>
</message>

HTML Form Sample HTML

<input type="hidden" name="accountId" value="YOUR-ACCOUNT-ID">
<input type="hidden" name="apiToken" value="YOUR-API-TOKEN">
<input type="hidden" name="action" value="subscriptionEdit">
<input type="hidden" name="subscriptionId" value="3215">
<input type="hidden" name="recurringPlanId" value="500">
<input type="hidden" name="customerCode" value="12A1152">
<input type="hidden" name="dateCreated" value="2017-07-01">
<input type="hidden" name="dateStarted" value="2017-07-01">
<input type="hidden" name="dateRemoved" value="2018-07-01">
<input type="hidden" name="amountRecurring" value="15.00">
<input type="hidden" name="amountInitial" value="0.00">
<input type="hidden" name="cyclesTotal" value="12">
<input type="hidden" name="status" value="1">