cancel
Showing results for 
Search instead for 
Did you mean: 

Automatic Recurring Billing (ARB) End Dates

How do you determin the end date of a ARB subscription (or if the subscription has no end date)?  The ARBGetSubscriptionRespone contains the start date - but no end date?  The interface to manually create the ARB subscription provides three GUI elements to control the end date: "no end date", "end date", "end after XX occurances".  So using the API, how do we determine if a subscription has no end date or a specific end date?

ptlapa
Member
1 REPLY 1

One way is to use a simple calculation based on the results of the ARBGetSubscriptionRequest: 

  <interval>
  <length>7</length>
  <unit>days</unit>
  </interval>
  <startDate>2018-02-01</startDate>
  <totalOccurrences>10</totalOccurrences>

The startDate and int variables would of course be retrieved by your application by parsing the XML or JSON, passed to a function, something like:

 

func calcEndDate(sDate string, toc int, length int) {
	startDate, _ := time.Parse("2006-01-02", sDate)
	subTotal := length * toc
	endDate := startDate.AddDate(0, 0, subTotal)
	fmt.Println("Subscription End Date will be : ", endDate.Format("2006-01-02"))

}

func main() {
	calcEndDate("2018-02-01", 10, 7)
}

Subscription End Date will be : 2018-04-12 

 

 

 

 

Powered by NexWebSites.com -
Certified Authorize.net developers
NexusSoftware
Trusted Contributor