To make a long story short, technical support couldn't provide me with an example nor would they tell me anything but "look at our website" which was less then helpful as it contradicted itself. Sometimes it would say to modify the plan subscription itself, sometimes it would say to create an addon. None of this is correct.
The correct way to do metered billing with Recurly using is to use the following procedure:
- Create an account without a subscription plan
- At the end of each month simple add an adjustment to the account and invoice the pending charges.
Code (C#):
private void CreateAccount(RecurlyAccount recurlyAccount) { var account = new Account(recurlyAccount.AccountCode) { FirstName = recurlyAccount.FirstName, LastName = recurlyAccount.LastName, Email = recurlyAccount.Email, CompanyName = recurlyAccount.CompanyName, }; account.BillingInfo = new BillingInfo(account) { LastName = recurlyAccount.RecurlyBillingInfo.FirstName, FirstName = recurlyAccount.RecurlyBillingInfo.LastName, Address1 = recurlyAccount.RecurlyBillingInfo.Address1, Address2 = recurlyAccount.RecurlyBillingInfo.Address2, City = recurlyAccount.RecurlyBillingInfo.City, State = recurlyAccount.RecurlyBillingInfo.State, Country = "US", PostalCode = recurlyAccount.RecurlyBillingInfo.PostalCode, CreditCardNumber = recurlyAccount.RecurlyBillingInfo.CreditCardNumber, CardType = recurlyAccount.RecurlyBillingInfo.CardType, ExpirationMonth = recurlyAccount.RecurlyBillingInfo.ExpirationMonth, ExpirationYear = recurlyAccount.RecurlyBillingInfo.ExpirationYear, Company = recurlyAccount.RecurlyBillingInfo.Company }; account.Create(); }
public virtual void BillCreditCard(Account account, int quantity, int amountInCents) { account.NewAdjustment("USD", amountInCents, "Orders", quantity).Create(); account.InvoicePendingCharges(); }