Subscriptions
Subscriptions
Subscription charges enable you to add your end users to a managed subscription service, where you can define how much and how often someone should be billed. All subsequent billing messages are handled by Payforit, as are STOP / STOP ALL requests.
Constructing an API call for a subscription should contain all of the same parameters as a one off transaction the parameters for this are as below:
Variable Name | Example | Description | Restrictions |
---|---|---|---|
campaign_name |
joebloggs | Your company/campaign name in our platform | Between 2 and 30 alphanumeric characters |
api_key |
88C3CF364123A25BBAB687D4FE8EC628 | Your password/API key in our platform | Will be provided on setup and is linked to your control panel login. |
value |
1.00 | The amount of money to charge the end user. | One or two digits, optionally followed by the decimal places, if required. |
currency |
GBP | The currency in which to charge the end user. | This must always be GBP in upper case. |
name |
Access to my secret page | The name of the product for which you are charging. This will be visible on the Payforit window. | Max length: 35 characters |
description |
Provides access to the secret members only page. | A short description of what the end user is purchasing. | Max length: 200 characters. |
callback_url |
http://yourserver.com/ | When the consumer has confirmed or declined the purchase, we can notify a URL of your choosing with the status of the transaction. Must be URL encoded |
null |
success_url |
http://yourserver.com /success/ |
When the consumer has confirmed purchase, this is the page they will be redirected to by Payforit.Additionally, the transaction id will be appended to the parameters returned (parameter: t )Must be URL encoded |
null |
cancel_url |
http://yourserver.com/ error/ |
When the consumer has declined purchase, this is the page they will be redirected to by Payforit.Additionally, the transaction id will be appended to the parameters returned (parameter: t )Must be URL encoded |
null |
The required additional parameters to make this a subscription
In addition to the above parameters, the following are required to make a subscription:
Variable Name | Example | Description | Restrictions |
---|---|---|---|
sub_repeat |
7 | How many times should the end user be billed in total? | Either a positive integer, or zero (never ending subscription). |
sub_period |
1 | In conjunction with sub_period_units, how often should the end user be charged? | A positive integer |
sub_period_units |
days | The units of sub_period to use | One of: hours, days, weeks, months |
Optional parameters
The following parameters are not required for most subscription services but have been included for completeness.Variable Name | Example | Description | Restrictions |
---|---|---|---|
sub_free_period |
1 | Together with the sub_free_period_units, this defines how long the end user has free at the beginning of the subscription. This parameter is the number of units (days, weeks, etc) that the free period lasts for.The value must be a positive integer. If there is no free period, do not include the parameter. The maximum free period you can set is 45 days. Required: Only when subscriptionFreePeriodUnits is also specified. | A positive integer Default: 1 day |
sub_free_period_units |
days | The units of sub_free_period to use. This must be one of: Hours, Days, Weeks or Months (these are case sensitive). | If there is no free period, do not include the parameter. The maximum free period you can set is 45 days. Required: Only when subscriptionFreePeriod is also specified. |