Create a subscription
POST/api/v3/package
Below is a simple example – the new billing package will use the default shipping and billing address from the customer, and the default pricing from the item (item #239). The first invoice won’t be sent until the holduntil_datetime date (October 1, 2013).
When adding a new package, you can specify the payment method by using paymethod
field.
If you know the
creditcard_id
,ach_id
, ortokenized_id
value you want to use for payment, just specify that field and value - you do not need to specifypaymethod
at all in this case.To use any credit card the customer already has on file, just specify
"paymethod": "crd"
.To use any ACH/eCheck account the customer already has on file, just specify
"paymethod": "ach"
.To use any payment method available for this customer, just specify
"paymethod": "any"
.If you do not specify a payment method at all, ChargeOver will default to sending an invoice to the customer.
Optionally, when adding a new package, you can specify the payment cycle (how often the customer gets invoiced and/or charged for the subscription) by using the paycycle
field.
There are several payment cycles you can set a package to run on:
dly
- Daily1wk
- Every week2wk
- Every other week116
- 1st and the 16th4wk
- Every four weeks8wk
- Every eight weeks30d
- Every 30 daysmon
- Monthly2mn
- Every other month12w
- Every twelve weeksqtr
- Quarterlysix
- Every six monthsyrl
- Yearly2yr
- Every 2 years3yr
- Every 3 years4yr
- Every 4 years5yr
- Every 5 years10y
- Every 10 years
If you do not specify a paycycle
, the payment cycle for the subscription will set to the default payment cycle configured in your account's General Settings.
ChargeOver supports mixed payment cycle subscriptions, e.g. where part of the subscription is monthly, and part of it is yearly.
Each line item can have its own payment cycle, as defined by the paycycle
attribute. If you do not
define a payment cycle for the line, it defaults to the payment cycle set on the product/discount being used.
Important: Invoices are created using the paycycle
of the subscription itself.
Generally, your subscription payment cycle should be equal to the shortest payment cycle your lines use.
Examples:
- Subscription
paycycle=mon
(monthly), Linepaycycle=yrl
(yearly) - invoices are created monthly, but the line will only occur once per year. - Subscription
paycycle=yrl
(yearly), Linepaycycle=mon
(monthly) - invoices are created yearly, and each invoice will contain 12 lines (one for each month).
You can create prorated subscriptions which either generate a prorated invoice right away, or put the prorated charge on the next invoice.
The example to the right creates a new subscription, and generates a prorated invoice for the period March 12, to the end of March. The next invoice date will be April 1.
Request
- application/json
Body
Customer ID #
Class ID #
External key value
Nickname for the subscription
Payment method for the subscription, one of: crd, inv, ach, tok
Credit card ID # (if the subscription is paid by credit card)
ACH ID # (if the subscription is paid by ACH)
Tokenized ID # (if the subscription is paid by an external service token)
Admin/worker ID #
Billing address line 1
Billing address line 2
Billing address line 3
Billing address city
Billing address state
Billing address postal code
Billing address country
(Deprecated)
Shipping address line 1
Shipping address line 2
Shipping address line 3
Shipping address city
Shipping address state
Shipping address postal code
Shipping address country
(Deprecated)
Date/time invoicing for this subscription is being delayed until
Terms ID #
Payment cycle
Custom field #1
Custom field #2
Custom field #3
Custom field #4
Custom field #5
Custom field #6
Custom field #7
Custom field #8
Custom field #9
Custom field #10
Custom field #11
Custom field #12
Custom field #13
Custom field #14
Custom field #15
Custom field #16
Custom field #17
Custom field #18
Custom field #19
Custom field #20
Payment schedule to use for the first invoice generated
Payment schedule to use for subsequent generated invoices
A list of line items for the subscription
A list of tags
Responses
- 201
- 400
- 401
Object was created successfully
- application/json
- Schema
- Example (from schema)
- Example 1
Schema
response
object
{
"code": 0,
"status": "string",
"message": "string",
"details": {},
"response": {
"id": 0
}
}
{
"code": 201,
"status": "OK",
"message": "",
"details": {},
"response": {
"id": 1234
}
}
Bad request
- application/json
- Schema
- Example (from schema)
- Example 1
Schema
{
"code": 0,
"status": "string",
"message": "string",
"details": {},
"response": true
}
{
"code": 400,
"status": "Error",
"message": "Missing or invalid parameter.",
"details": {},
"response": false
}
Authentication error
- application/json
- Schema
- Example (from schema)
- Example 1
Schema
{
"code": 0,
"status": "string",
"message": "string",
"details": {},
"response": true
}
{
"code": 401,
"status": "Error",
"message": "Invalid or incorrect authorization [Missing (basic) authorization header.]",
"details": {},
"response": false
}