Payment Schedule Service - PaySimple/PaySimpleSDK GitHub Wiki

Home | Account Service | Customer Service | Payment Service | Payment Schedule Service | PagedResult | Exceptions

Payment Schedule Service

The Payment Schedule Service is used to create, get, delete, update, pause, resume and suspend Payment Plans and Recurring Payments. The SDK provides the following methods:

  • CreateNewAccountPaymentPlanAsync
  • CreateNewCustomerPaymentPlanAsync
  • CreatePaymentPlanAsync
  • CreateNewAccountRecurringPaymentAsync
  • CreateNewCustomerRecurringPaymentAsync
  • CreateRecurringPaymentAsync
  • CreateRecurringPaymentAsync
  • DeletePaymentPlanAsync
  • DeleteRecurringPaymentAsync
  • GetAllPaymentSchedulesAsync
  • GetPaymentPlanPaymentsAsync
  • GetPaymentPlanScheduleAsync
  • GetRecurringSchedulePaymentsAsync
  • GetRecurringScheduleAsync
  • PausePaymentPlanAsync
  • PauseRecurringPaymentAsync
  • ResumePaymentPlanAsync
  • ResumeRecurringPaymentAsync
  • SuspendPaymentPlanAsync
  • SuspendRecurringPaymentAsync
  • UpdateRecurringPaymentAsync

Constructor

Parameters:

Parameter Name Type Description Notes
settings IPaySimpleSdkSettings SDK Settings

Example:

var settings = new PaySimpleSettings("AoOtRylA63570WmH3eqChyFRqwhTnA2g0dnsV7zzQko4s4yKWdBorA1WiT7dK2H2xz06P562Hqv0heYBdfNamfQyxX50drtpL8s7", "AUserName");
var paymentScheduleService = new PaymentScheduleService(settings);

Service Methods


CreateNewAccountPaymentPlanAsync

CreateNewAccountPaymentPlanAsync is a convenience method that creates a new account and a new payment plan linked to an existing customer

Parameters:

Parameter Name Type Description Notes
accountPaymentPlan NewAccountPaymentPlan Account and PaymentPlan to create T is either Ach or CreditCard

Returns:

NewAccountPaymentPlan<T>

Example:

var accountPaymentPlan = new NewAccountPaymentPlan<Ach>
{
	Account = new Ach
	{
		CustomerId = 123456,
		RoutingNumber = "30707529",
		AccountNumber = "751111111",
		BankName = "PaySimple Bank"
	},
	PaymentPlan = new PaymentPlan
	{
		TotalDueAmount = 1200.00M,
		TotalNumberOfPayments = 12,
		ExecutionFrequencyType = ExecutionFrequencyType.SpecificDayOfMonth
		ExecutionFrequencyParameter = DateTime.Now.Day,
		StartDate = DateTime.Now
	}
};

var newAccountPaymentPlan = await paymentScheduleService.CreateNewAccountPaymentPlanAsync<Ach>(accountPaymentPlan);

CreateNewCustomerPaymentPlanAsync

CreateNewCustomerPaymentPlanAsync is a convenience method that creates a new customer, a new account and a new payment plan

Parameters:

Parameter Name Type Description Notes
customerPaymentPlan NewCustomerPaymentPlan Customer, Account and PaymentPlan to create T is either Ach or CreditCard

Returns:

NewCustomerPaymentPlan<T>

Example:

var customerPaymentPlan = new NewCustomerPaymentPlan<Ach>
{
	Customer = new Customer
	{
		FirstName = "Inara",
		LastName = "Serra"
	},
	Account = new Ach
	{		
		RoutingNumber = "30707529",
		AccountNumber = "751111111",
		BankName = "PaySimple Bank"
	},
	PaymentPlan = new PaymentPlan
	{
		TotalDueAmount = 1200.00M,
		TotalNumberOfPayments = 12,
		ExecutionFrequencyType = ExecutionFrequencyType.SpecificDayOfMonth
		ExecutionFrequencyParameter = DateTime.Now.Day,
		StartDate = DateTime.Now
	}
};

var newCustomerPaymentPlan = await paymentScheduleService.CreateNewCustomerPaymentPlanAsync<Ach>(customerPaymentPlan);

CreatePaymentPlanAsync

CreatePaymentPlanAsync creates a new Payment Plan

Parameters:

Parameter Name Type Description Notes
paymentPlan PaymentPlan PaymentPlan to create

Returns:

PaymentPlan

Example:

var paymentPlan = new PaymentPlan
{
	TotalDueAmount = 1200.00M,
	TotalNumberOfPayments = 12,
	ExecutionFrequencyType = ExecutionFrequencyType.SpecificDayOfMonth
	ExecutionFrequencyParameter = DateTime.Now.Day,
	StartDate = DateTime.Now
}

var result = await paymentScheduleService.CreatePaymentPlanAsync(paymentPlan);

CreateNewAccountRecurringPaymentAsync

CreateNewAccountRecurringPaymentAsync is a convenience method that creates a new account and a new recurring payment linked to an existing customer

Parameters:

Parameter Name Type Description Notes
accountRecurringPayment NewAccountRecurringPayment Account and RecurringPayment to create T is either Ach or CreditCard

Returns:

NewAccountRecurringPayment<T>

Example:

var accountRecurringPayment = new NewAccountRecurringPayment<Ach>
{
	Account = new Ach
	{
		CustomerId = 123456,
		RoutingNumber = "30707529",
		AccountNumber = "751111111",
		BankName = "PaySimple Bank"
	},
	RecurringPayment = new RecurringPayment
	{
		PaymentAmount = 25.00M
		ExecutionFrequencyType = ExecutionFrequencyType.FirstOfMonth,		
		StartDate = DateTime.Now
	}
};

var newAccountRecurringPayment = await paymentScheduleService.CreateNewAccountRecurringPaymentAsync<Ach>(accountRecurringPayment);

CreateNewCustomerRecurringPaymentAsync

CreateNewCustomerRecurringPaymentAsync is a convenience method that creates a new customer, a new account and a new recurring payment

Parameters:

Parameter Name Type Description Notes
customerRecurringPayment NewCustomerRecurringPayment Customer, Account and RecurringPayment to create T is either Ach or CreditCard

Returns:

NewCustomerRecurringPayment<T>

Example:

var customerRecurringPayment = new NewCustomerRecurringPayment<Ach>
{
	Customer = new Customer
	{
		FirstName = "Hoban",
		LastName = "Washburne"
	},
	Account = new Ach
	{		
		RoutingNumber = "30707529",
		AccountNumber = "751111111",
		BankName = "PaySimple Bank"
	},
	RecurringPayment = new RecurringPayment
	{
		PaymentAmount = 25.00M
		ExecutionFrequencyType = ExecutionFrequencyType.FirstOfMonth,		
		StartDate = DateTime.Now.AddDays(1)
	}
};

var newCustomerRecurringPayment = await paymentScheduleService.CreateNewCustomerRecurringPaymentAsync<Ach>(customerRecurringPayment);

CreateRecurringPaymentAsync

CreateRecurringPaymentAsync creates a new Recurring Payment

Parameters:

Parameter Name Type Description Notes
recurringPayment RecurringPayment RecurringPayment to create

Returns:

RecurringPayment

Example:

var recurringPayment = new RecurringPayment
{
	PaymentAmount = 25.00M
	ExecutionFrequencyType = ExecutionFrequencyType.FirstOfMonth,		
	StartDate = DateTime.Now.AddDays(1)
};

var result = await paymentScheduleService.CreateRecurringPaymentAsync(recurringPayment);

DeletePaymentPlanAsync

DeletePaymentPlanAsync deletes an existing PaymentPlan

Parameters:

Parameter Name Type Description Notes
paymentPlanId int Id of the PaymentPlan to Delete

Example:

await paymentScheduleService.DeletePaymentPlanAsync(123456);

DeleteRecurringPaymentAsync

DeleteRecurringPaymentAsync deletes an existing RecurringPayment

Parameters:

Parameter Name Type Description Notes
recurringPaymentId int Id of the RecurringPayment to Delete

Example:

await paymentScheduleService.DeleteRecurringPaymentAsync(123456);

GetAllPaymentSchedulesAsync

GetAllPaymentSchedulesAsync all existing payment schedules where a schedule can be of two types: payment plan, recurring payment

Returns:

Result<IEnumerable<PaymentSchedule>>

Example:

var paymentSchedules = await paymentScheduleService.GetAllPaymentSchedulesAsync();

GetPaymentPlanPaymentsAsync

GetPaymentPlanPaymentsAsync all existing Payments for a specific Payment Plans

Parameters:

Parameter Name Type Description Notes
paymentPlanId int Id of the PaymentPlan to get Payments for

Returns:

PagedResult<IEnumerable<Payment>>

Example:

var payments = await paymentScheduleService.GetPaymentPlanPaymentsAsync(123456);

GetPaymentPlanScheduleAsync

GetPaymentPlanScheduleAsync gets a specific Payment Plan

Parameters:

Parameter Name Type Description Notes
paymentPlanId int Id of the PaymentPlan to get

Returns:

PaymentPlan

Example:

var paymentPlan = await paymentScheduleService.GetPaymentPlanScheduleAsync(123456);

GetRecurringSchedulePaymentsAsync

GetRecurringSchedulePaymentsAsync all payments for a specific Recurring Schedule

Parameters:

Parameter Name Type Description Notes
recurringPaymentId int Id of the RecurringPayment to get Payments for

Returns:

PagedResult<IEnumerable<Payment>>

Example:

var payments = await paymentScheduleService.GetRecurringSchedulePaymentsAsync(123456);

GetRecurringScheduleAsync

GetRecurringScheduleAsync a specific Recurring Payment schedule

Parameters:

Parameter Name Type Description Notes
recurringPaymentId int Id of the RecurringPayment to get

Returns:

RecurringPayment

Example:

var recurringPayment = await paymentScheduleService.GetRecurringScheduleAsync(123456);

PausePaymentPlanAsync

PausePaymentPlanAsync pauses an existing Payment Plan

Parameters:

Parameter Name Type Description Notes
paymentPlanId int Id of the PaymentPlan to pause
endDate DateTime Date to resume the PaymentPlan

Example:

await paymentScheduleService.PausePaymentPlanAsync(123456, DateTime.Now.AddMonths(2));

PauseRecurringPaymentAsync

PauseRecurringPaymentAsync pauses an existing Recurring Payment

Parameters:

Parameter Name Type Description Notes
recurringPaymentId int Id of the RecurringPayment to pause
endDate DateTime Date to resume the RecurringPayment

Example:

await paymentScheduleService.PauseRecurringPaymentAsync(123456, DateTime.Now.AddMonths(2));

ResumePaymentPlanAsync

ResumePaymentPlanAsync resumes a paused Payment Plan

Parameters:

Parameter Name Type Description Notes
paymentPlanId int Id of the PaymentPlan to resume

Example:

await paymentScheduleService.ResumePaymentPlanAsync(123456);

ResumeRecurringPaymentAsync

ResumeRecurringPaymentAsync resumes a paused Recurring Payment

Parameters:

Parameter Name Type Description Notes
recurringPaymentId int Id of the RecurringPayment to resume

Example:

await paymentScheduleService.ResumeRecurringPaymentAsync(123456);

SuspendPaymentPlanAsync

SuspendPaymentPlanAsync suspends an existing Payment Plan

Parameters:

Parameter Name Type Description Notes
paymentPlanId int Id of the PaymentPlan to suspend

Example:

await paymentScheduleService.SuspendPaymentPlanAsync(123456);

SuspendRecurringPaymentAsync

SuspendRecurringPaymentAsync suspends an existing Recurring Payment

Parameters:

Parameter Name Type Description Notes
recurringPaymentId int Id of the RecurringPayment to suspend

Example:

await paymentScheduleService.SuspendRecurringPaymentAsync(123456);

UpdateRecurringPaymentAsync

UpdateRecurringPaymentAsync updates an existing Recurring Payment

Parameters:

Parameter Name Type Description Notes
recurringPayment RecurringPayment RecurringPayment to update

Returns:

RecurringPayment

Example:

var recurringPayment = new RecurringPayment
{
	PaymentAmount = 15.00M
	ExecutionFrequencyType = ExecutionFrequencyType.LastOfMonth
};

var result = await paymentScheduleService.UpdateRecurringPaymentAsync(recurringPayment);
⚠️ **GitHub.com Fallback** ⚠️