Payment Schedule Service - PaySimple/PaySimpleSDK GitHub Wiki
Home | Account Service | Customer Service | Payment Service | Payment Schedule Service | PagedResult | Exceptions
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
Parameter Name | Type | Description | Notes |
---|---|---|---|
settings | IPaySimpleSdkSettings | SDK Settings |
var settings = new PaySimpleSettings("AoOtRylA63570WmH3eqChyFRqwhTnA2g0dnsV7zzQko4s4yKWdBorA1WiT7dK2H2xz06P562Hqv0heYBdfNamfQyxX50drtpL8s7", "AUserName");
var paymentScheduleService = new PaymentScheduleService(settings);
CreateNewAccountPaymentPlanAsync is a convenience method that creates a new account and a new payment plan linked to an existing customer
Parameter Name | Type | Description | Notes |
---|---|---|---|
accountPaymentPlan | NewAccountPaymentPlan | Account and PaymentPlan to create | T is either Ach or CreditCard |
NewAccountPaymentPlan<T>
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 is a convenience method that creates a new customer, a new account and a new payment plan
Parameter Name | Type | Description | Notes |
---|---|---|---|
customerPaymentPlan | NewCustomerPaymentPlan | Customer, Account and PaymentPlan to create | T is either Ach or CreditCard |
NewCustomerPaymentPlan<T>
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 creates a new Payment Plan
Parameter Name | Type | Description | Notes |
---|---|---|---|
paymentPlan | PaymentPlan | PaymentPlan to create |
PaymentPlan
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 is a convenience method that creates a new account and a new recurring payment linked to an existing customer
Parameter Name | Type | Description | Notes |
---|---|---|---|
accountRecurringPayment | NewAccountRecurringPayment | Account and RecurringPayment to create | T is either Ach or CreditCard |
NewAccountRecurringPayment<T>
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 is a convenience method that creates a new customer, a new account and a new recurring payment
Parameter Name | Type | Description | Notes |
---|---|---|---|
customerRecurringPayment | NewCustomerRecurringPayment | Customer, Account and RecurringPayment to create | T is either Ach or CreditCard |
NewCustomerRecurringPayment<T>
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 creates a new Recurring Payment
Parameter Name | Type | Description | Notes |
---|---|---|---|
recurringPayment | RecurringPayment | RecurringPayment to create |
RecurringPayment
var recurringPayment = new RecurringPayment
{
PaymentAmount = 25.00M
ExecutionFrequencyType = ExecutionFrequencyType.FirstOfMonth,
StartDate = DateTime.Now.AddDays(1)
};
var result = await paymentScheduleService.CreateRecurringPaymentAsync(recurringPayment);
DeletePaymentPlanAsync deletes an existing PaymentPlan
Parameter Name | Type | Description | Notes |
---|---|---|---|
paymentPlanId | int | Id of the PaymentPlan to Delete |
await paymentScheduleService.DeletePaymentPlanAsync(123456);
DeleteRecurringPaymentAsync deletes an existing RecurringPayment
Parameter Name | Type | Description | Notes |
---|---|---|---|
recurringPaymentId | int | Id of the RecurringPayment to Delete |
await paymentScheduleService.DeleteRecurringPaymentAsync(123456);
GetAllPaymentSchedulesAsync all existing payment schedules where a schedule can be of two types: payment plan, recurring payment
Result<IEnumerable<PaymentSchedule>>
var paymentSchedules = await paymentScheduleService.GetAllPaymentSchedulesAsync();
GetPaymentPlanPaymentsAsync all existing Payments for a specific Payment Plans
Parameter Name | Type | Description | Notes |
---|---|---|---|
paymentPlanId | int | Id of the PaymentPlan to get Payments for |
PagedResult<IEnumerable<Payment>>
var payments = await paymentScheduleService.GetPaymentPlanPaymentsAsync(123456);
GetPaymentPlanScheduleAsync gets a specific Payment Plan
Parameter Name | Type | Description | Notes |
---|---|---|---|
paymentPlanId | int | Id of the PaymentPlan to get |
PaymentPlan
var paymentPlan = await paymentScheduleService.GetPaymentPlanScheduleAsync(123456);
GetRecurringSchedulePaymentsAsync all payments for a specific Recurring Schedule
Parameter Name | Type | Description | Notes |
---|---|---|---|
recurringPaymentId | int | Id of the RecurringPayment to get Payments for |
PagedResult<IEnumerable<Payment>>
var payments = await paymentScheduleService.GetRecurringSchedulePaymentsAsync(123456);
GetRecurringScheduleAsync a specific Recurring Payment schedule
Parameter Name | Type | Description | Notes |
---|---|---|---|
recurringPaymentId | int | Id of the RecurringPayment to get |
RecurringPayment
var recurringPayment = await paymentScheduleService.GetRecurringScheduleAsync(123456);
PausePaymentPlanAsync pauses an existing Payment Plan
Parameter Name | Type | Description | Notes |
---|---|---|---|
paymentPlanId | int | Id of the PaymentPlan to pause | |
endDate | DateTime | Date to resume the PaymentPlan |
await paymentScheduleService.PausePaymentPlanAsync(123456, DateTime.Now.AddMonths(2));
PauseRecurringPaymentAsync pauses an existing Recurring Payment
Parameter Name | Type | Description | Notes |
---|---|---|---|
recurringPaymentId | int | Id of the RecurringPayment to pause | |
endDate | DateTime | Date to resume the RecurringPayment |
await paymentScheduleService.PauseRecurringPaymentAsync(123456, DateTime.Now.AddMonths(2));
ResumePaymentPlanAsync resumes a paused Payment Plan
Parameter Name | Type | Description | Notes |
---|---|---|---|
paymentPlanId | int | Id of the PaymentPlan to resume |
await paymentScheduleService.ResumePaymentPlanAsync(123456);
ResumeRecurringPaymentAsync resumes a paused Recurring Payment
Parameter Name | Type | Description | Notes |
---|---|---|---|
recurringPaymentId | int | Id of the RecurringPayment to resume |
await paymentScheduleService.ResumeRecurringPaymentAsync(123456);
SuspendPaymentPlanAsync suspends an existing Payment Plan
Parameter Name | Type | Description | Notes |
---|---|---|---|
paymentPlanId | int | Id of the PaymentPlan to suspend |
await paymentScheduleService.SuspendPaymentPlanAsync(123456);
SuspendRecurringPaymentAsync suspends an existing Recurring Payment
Parameter Name | Type | Description | Notes |
---|---|---|---|
recurringPaymentId | int | Id of the RecurringPayment to suspend |
await paymentScheduleService.SuspendRecurringPaymentAsync(123456);
UpdateRecurringPaymentAsync updates an existing Recurring Payment
Parameter Name | Type | Description | Notes |
---|---|---|---|
recurringPayment | RecurringPayment | RecurringPayment to update |
RecurringPayment
var recurringPayment = new RecurringPayment
{
PaymentAmount = 15.00M
ExecutionFrequencyType = ExecutionFrequencyType.LastOfMonth
};
var result = await paymentScheduleService.UpdateRecurringPaymentAsync(recurringPayment);