Activate Customer's Specific Subscriptions and Purchases

This call is used to activate/finalize draft subscriptions/purchases on a customer who is already in status 'Active'. This can be used to activate/finalize all of their draft subscriptions/purchases, or a subset of their draft subscriptions/purchases

Path Parameters

PropertyTypeDescription
customerIDIntegerThe Fusebill generated ID that uniquely identifies the customer

Request Parameters

PropertyTypeDescriptionRequired
previewBooleanIf true, results in no system change. Instead, a preview of the resulting invoice and charges are returned as a response. False by defaultOptional
temporarilyDisableAutoPostBooleanIf true, then the invoice that might otherwise automatically be posted as a result of this POST will instead be created in 'draft' form. False by defaultOptional
invoiceCollectOptionsObject. Defined belowThis can be used to provide special invoice collection instructionsOptional
specificSubscriptionIdsList of IntegersA list of the specific draft subscription Fusebill IDs belonging to this customer that are to be activatedOptional
specificPurchaseIdsList of IntegersA list of the specific draft purchase Fusebill IDs belonging to this customer that are to be finalizedOptional

🚧

Providing no JSON body

This call can be made with no JSON body. Doing this has the effect of activating all the draft subscriptions on the customer, and finalizing all the draft purchases on the customer. Providing the specificPurchaseIds or specificSubscriptionIds tells Fusebill to activate/finalize a subset of the customer's draft subscriptions/purchases

Invoice Collect Options

PropertyTypeDescription
paymentMethodEnum: { UseDefaultPaymentMethod, UseExistingPaymentMethod, UseExistingPaymentMethodAndMakeDefault, UseProvidedPaymentMethodOnce, UseProvidedPaymentMethodAndMakeDefault, UseProvidedPaymentMethodAndSave, CreateAndApplyCredit}Controls which payment method to use
paymentMethodIdIntegerID of the payment method.
useAnyAvailableFundsFirstBooleanControls whether available funds on the customer entity should be used first.
creditCardObjectSee credit card creation parameters as outlined in Create Credit Card Payment Method
achCardObjectSee ACH card creation parameters as outlined in Create ACH Payment Method
rollbackOnFailedPaymentBooleanIf payment fails, Fusebill can undo this action and prevent the invoice from posting.
Examples
curl –X POST https://secure.fusebill.com/v1/customers/purchase/12345 \ 
  -H "Content-Type: application/json" \ 
  -H "Authorization: Basic {APIKey}" \ 
  -d "{specificSubscriptionIds:[1254352,5463542,4523453],specificPurchaseIds: [5452451,6798652,8768453]}"
//Json data 
string jsonData = "{'specificSubscriptionIds':[1254352,5463542,4523453],'specificPurchaseIds': [5452451,6798652,8768453]}"; 
//Setup API key 
string apiKey = "{APIKey}"; 
//Configure URI 
WebRequest request = WebRequest.Create("HTTPS://secure.fusebill.com/v1/customers/purchase/12345"); 
//Add Content type 
request.ContentType = "application/json"; 
//Add Api key authorization 
request.Headers.Add(HttpRequestHeader.Authorization, "Basic "+apiKey); 
//Set request method 
request.Method = "POST"; 
//Add the json data to request 
using (var streamWriter = new StreamWriter(request.GetRequestStream())) 
{ 
  streamWriter.Write(jsonData); 
  streamWriter.Flush(); 
  streamWriter.Close(); 
} 
//Perform the request 
var httpResponse = (HttpWebResponse)request.GetResponse(); 
//Record the response from our request 
var result = ""; 
using (var streamReader = new StreamReader(httpResponse.GetResponseStream())) 
{ 
  result = streamReader.ReadToEnd(); 
}
#Import library JSON 
import json 
#Import library Requests 
import requests 
#Pass in a dictionary to the Headers parameter 
headers = {'Authorization' : 'Basic {APIKey}', 'Content-Type' : 'application/json'} 
#Pass in a dict to the Payload parameter 
payload = {'specificSubscriptionIds':[1254352,5463542,4523453],'specificPurchaseIds':[5452451,6798652,8768453} 
#Pass in your URI, Payload and Headers 
r = requests.post('https://secure.fusebill.com/v1/customers/purchase/12345', data=json.dumps(payload), headers=headers) 
print(r.content)
{
    "specificSubscriptionIds": [
        1254352,
        5463542,
        4523453
    ],
    "specificPurchaseIds": [
        5452451,
        6798652,
        8768453
    ]
}
{
    "preview": false,
    "temporarilyDisableAutoPost": false,
    "invoiceCollectOptions": {
        "paymentMethod": "UseProvidedPaymentMethodAndSave",
        "useAnyAvailableFundsFirst": false,
        "creditCard": {
            "cardNumber": 1234123412341234,
            "expirationMonth": 2,
            "expirationYear": 23,
            "cvv": 123,
            "firstName": "Karen",
            "lastName": "Wood",
            "address1": "10 Dodge St",
            "address2": "",
            "city": "Columbia",
            "stateId": 1,
            "countryId": 124,
            "source": "Manual",
            "postalZip": "V9V 9V9",
            "customerId": 12345678
        },
        "achCard": null,
        "rollbackOnFailedPayment": true
    },
    "specificSubscriptionIds": [
        1254352,
        5463542,
        4523453
    ],
    "specificPurchaseIds": [
        5452451,
        6798652,
        8768453
    ]
}
Response
{
    "invoicePreview": {
        "draftCharges": [
            {
                "transactionId": 0,
                "chargeTypeId": null,
                "transactionType": "Charge",
                "quantity": 1.0,
                "unitPrice": 250.00,
                "amount": 250.00,
                "taxableAmount": 250.00,
                "subscriptionPeriodId": 0,
                "draftInvoiceId": 0,
                "name": "Premium Access",
                "description": null,
                "effectiveTimestamp": "2020-01-23T17:38:07.0001004Z",
                "proratedUnitPrice": null,
                "startServiceDate": "2020-01-23T00:00:00",
                "endServiceDate": "2020-02-22T00:00:00",
                "rangeQuantity": null,
                "draftDiscount": null,
                "draftDiscounts": [],
                "status": "Active",
                "productItems": null,
                "canProrateCharge": false,
                "postable": true,
                "subscriptionProductId": 25714915,
                "purchaseId": null,
                "productId": 25044592,
                "draftChargeTiers": [],
                "id": 0,
                "uri": null
            },
            {
                "transactionId": 0,
                "chargeTypeId": null,
                "transactionType": "Charge",
                "quantity": 0.0,
                "unitPrice": 10.00,
                "amount": 0.00,
                "taxableAmount": 0.00,
                "subscriptionPeriodId": 0,
                "draftInvoiceId": 0,
                "name": "GPS device",
                "description": null,
                "effectiveTimestamp": "2020-01-23T17:38:07.0001004Z",
                "proratedUnitPrice": null,
                "startServiceDate": "2020-01-23T00:00:00",
                "endServiceDate": "2020-01-23T00:00:00",
                "rangeQuantity": null,
                "draftDiscount": null,
                "draftDiscounts": [],
                "status": "Active",
                "productItems": null,
                "canProrateCharge": false,
                "postable": true,
                "subscriptionProductId": 25714913,
                "purchaseId": null,
                "productId": 25188589,
                "draftChargeTiers": [],
                "id": 0,
                "uri": null
            }
        ],
        "subtotal": 250.00,
        "total": 250.00,
        "draftTaxes": [],
        "totalTaxes": 0.00,
        "totalDiscount": 0.0,
        "poNumber": null,
        "effectiveTimestamp": "0001-01-01T00:00:00",
        "status": "Ready",
        "draftChargeGroups": [
            {
                "name": "bronze",
                "description": "the bronze plan",
                "reference": null,
                "subscriptionId": 12092276,
                "draftCharges": [
                    {
                        "transactionId": 0,
                        "chargeTypeId": null,
                        "transactionType": "Charge",
                        "quantity": 1.0,
                        "unitPrice": 250.00,
                        "amount": 250.00,
                        "taxableAmount": 250.00,
                        "subscriptionPeriodId": 0,
                        "draftInvoiceId": 0,
                        "name": "Premium Access",
                        "description": null,
                        "effectiveTimestamp": "2020-01-23T17:38:07.0001004Z",
                        "proratedUnitPrice": null,
                        "startServiceDate": "2020-01-23T00:00:00",
                        "endServiceDate": "2020-02-22T00:00:00",
                        "rangeQuantity": null,
                        "draftDiscount": null,
                        "draftDiscounts": [],
                        "status": "Active",
                        "productItems": null,
                        "canProrateCharge": false,
                        "postable": true,
                        "subscriptionProductId": 25714915,
                        "purchaseId": null,
                        "productId": 25044592,
                        "draftChargeTiers": [],
                        "id": 0,
                        "uri": null
                    },
                    {
                        "transactionId": 0,
                        "chargeTypeId": null,
                        "transactionType": "Charge",
                        "quantity": 0.0,
                        "unitPrice": 10.00,
                        "amount": 0.00,
                        "taxableAmount": 0.00,
                        "subscriptionPeriodId": 0,
                        "draftInvoiceId": 0,
                        "name": "GPS tracker",
                        "description": null,
                        "effectiveTimestamp": "2020-01-23T17:38:07.0001004Z",
                        "proratedUnitPrice": null,
                        "startServiceDate": "2020-01-23T00:00:00",
                        "endServiceDate": "2020-01-23T00:00:00",
                        "rangeQuantity": null,
                        "draftDiscount": null,
                        "draftDiscounts": [],
                        "status": "Active",
                        "productItems": null,
                        "canProrateCharge": false,
                        "postable": true,
                        "subscriptionProductId": 25714913,
                        "purchaseId": null,
                        "productId": 25188589,
                        "draftChargeTiers": [],
                        "id": 0,
                        "uri": null
                    }
                ]
            }
        ],
        "notes": null,
        "shippingInstructions": null,
        "openingArBalance": 250.0000,
        "closingArBalance": 500.0000,
        "creditFromAvailableFunds": 0.0
    }
}
{
    "ErrorId": 0,
    "HttpStatusCode": 400,
    "Errors": [
        {
            "Key": "Api Error",
            "Value": "Unable to complete purchase, there was nothing to purchase for this customer."
        }
    ]
}
Language
Authorization