Skip to main content
Version: Lab (preview)

Recurring Payment

A recurring payment represents a payment that will trigger on an interval.

You can create a recurring payment with a set number of payments to enable a payment plan for a payor.

You can also create a recurring payment with no set payment amounts to enable a subscription for a payor.


The Recurring Payment Object​

{
account_code: String
amount_per_payment: Int
created_date: AWSDateTime
currency: String
fee_mode: FeeMode
fee_per_payment: Int
is_active: Boolean
is_processing: Boolean
recurring_id: String
merchant_uid: String
metadata: AWSJSON
mute_all_emails: Boolean
next_payment_date: AWSDate
payment_interval: RecurringInterval
payment_method: PaymentMethodToken
payor: Payor
prev_payment_date: AWSDate
recurring_description: String
recurring_name: String
reference: String
remaining_payments: Int
status: RecurringStatus
total_amount_per_payment: Int
}
Keytypedescription
account_codeStringCustom account code for the recurring payment that will be tied to each payment.
amount_per_paymentIntThe amount of the recurring payment.
created_dateDateTimeThe date the recurring payment was created.
currencyStringThe type of currency for the recurring payment.
fee_modeFeeModeThe fee mode for the recurring payment.
fee_per_paymentIntThe fee for the recurring payment.
is_activeBooleanWhether the recurring payment is active or been disabled.
is_processingBooleanWhether the recurring payment is currently processing.
merchant_uidStringThe Pay Theory unique identifier assigned to the merchant that the recurring payment belongs to.
metadataJSONCustom metadata for the recurring payment that will be tied to each payment.
mute_all_emailsBooleanManage whether the payor will receive emails for the recurring payment from Pay Theory.
next_payment_dateDateTimeThe date of the next payment to be made for the recurring payment.
payment_intervalRecurringIntervalThe interval of the recurring payment.
payment_methodPaymentMethodTokenThe payment method used to make the recurring payment.
payorPayorThe payor that the recurring payment belongs to.
prev_payment_dateDateTimeThe date of the last payment made for the recurring payment.
recurring_descriptionStringCustom description for the recurring payment.
recurring_idStringThe Pay Theory unique identifier assigned to the recurring payment.
recurring_nameStringCustom name for the recurring payment.
referenceStringCustom reference for the recurring payment that will be tied to each payment.
remaining_paymentsIntThe number of payments remaining for the recurring payment.
statusRecurringStatusThe status of the recurring payment.
total_amount_per_paymentIntThe amount the payor will be charged for the recurring payment.

Recurring Interval​

The interval of the recurring payment. The following intervals are available:

  • WEEKLY
  • BI_WEEKLY
  • MONTHLY
  • QUARTERLY
  • BI_ANNUAL
  • ANNUAL

Recurring Status​

The status of the recurring payment. The following statuses are available:

  • SYSTEM_FAILURE
    • The recurring payment failed due to a system error. Will retry automatically till system issue resolved.
  • INSTRUMENT_FAILURE
    • The recurring payment failed due to a payment method error. Will not retry until payment method is updated.
  • SUCCESS
    • The last payment was successful.

Get Recurring Payments​

{
recurringPayments(direction: MoveDirection, limit: Int, offset: String, offset_id: String, query: SqlQuery) {
items {
account_code
amount_per_payment
created_date
currency
fee_mode
fee_per_payment
is_active
is_processing
merchant_uid
metadata(query_list: $metadata_query)
mute_all_emails
next_payment_date
payment_interval
payment_method(query_list: $payment_method_query)) {
...payment_method_object
}
prev_payment_date
payor(query_list: $payor_query) {
...payor_object
}
recurring_description
recurring_id
recurring_name
reference
remaining_payments
status
total_amount_per_payment
}
}
}

Parameters

Keytypedescription
directionMoveDirectionThe direction of the pagination. Makes sure the results are returned in the correct order.
limitIntThe number of recurring payments to return.
offsetStringThe value of the offset item for which the list is being sorted.
offset_idStringThe recurring_id of the offset item.
querySqlQueryThe query to filter the recurring payments with based on Pay Theory defined data. Detailed information about the query object can be found here.

Nested Queries Recurring Payments can also be filtered by passing a query_list to the metadata, payment method, or payor.

This will only return Recurring Payments that have Metadata, Payment Methods, or Payors that match these queries. Detailed information about the query list can be found here.

Returns

Keytypedescription
items[RecurringPayment]The list of recurring payments that are returned from the query.
total_row_countIntThe total number of recurring payments that match the query. Used to help with pagination.

Create Recurring Payment​

mutation {
createRecurringPayment(input: {
account_code: String,
amount: Int,
currency: String,
fee_mode: FEE_MODE,
first_payment_date: Date,
merchant_uid: String,
metadata: JSON,
payment_count: Int,
payment_interval: PAYMENT_INTERVAL,
payment_method_id: String,
payor_id: String,
payor: Payor,
recurring_description: String,
recurring_name: String,
reference: String,
mute_all_emails: Boolean
}) {
account_code
...recuring_payment_object
}
}

Parameters

Keytypedescription
inputRecurringPaymentInputThe input object that contains the details to create a new recurring payment.

RecurringPaymentInput

Keytypedescription
account_codeStringCustom account code for the recurring payment that will be tied to each payment.
amountInt!The amount of the recurring payment.
currencyStringThe type of currency for the recurring payment.
fee_modeFeeModeThe fee mode for the recurring payment.
first_payment_dateDateThe date of the first payment. If not provided, the first payment will be made immediately.
merchant_uidString!The merchant_uid of the merchant that the recurring payment belongs to.
metadataJSONCustom metadata for the recurring payment that will be tied to each payment.
payment_countIntThe number of payments to be made. If not provided, the recurring payment will continue until cancelled.
payment_intervalRecurringInterval!The interval of the recurring payment.
payment_method_idString!The payment_method_id of the tokenized payment method that will be used for the recurring payment.
payor_idStringThe payor_id of the payor that the recurring payment will be tied to.
payorPayorThe payor object that the recurring payment will be tied to.
recurring_descriptionStringCustom description for the recurring payment that will be tied to each payment.
recurring_nameString!Custom name for the recurring payment.
referenceStringCustom reference for the recurring payment that will be tied to each payment.
mute_all_emailsBooleanManage whether the payor will receive emails for the recurring payment from Pay Theory.

Returns

The call will return the newly created recurring payment.


Update Recurring Payment​

mutation {
updateRecurringPayment(
input: {
payment_method_id: String,
recurring_id: String,
pay_all_missed_payments: Boolean
mute_all_emails: Boolean
}) {
... recurring_payment_object
}
}

Parameters

Keytypedescription
inputUpdateRecurringPaymentInputThe input object that contains the details to update the recurring payment.

UpdateRecurringPaymentInput

Keytypedescription
payment_method_idStringThe payment_method_id of the tokenized payment method that will be used for the recurring payment.
recurring_idString!The recurring_id of the recurring payment to be updated.
pay_all_missed_paymentsBooleanIf the recurring payment has a set number of payments (Payment Plan) and is in a Failed state, this will make a one time charge to account for all missed payments to get it back in to a Successful state.
mute_all_emailsBooleanIf set to true, no emails will be sent to the payor for this recurring payment.

Returns

The call will return the updated recurring payment object.


Cancel Recurring Payment​

Once a recurring payment is cancelled, it cannot be reactivated.

mutation {
cancelRecurringPayment(recurring_id: String)
}

Parameters

Keytypedescription
recurring_idStringThe recurring_id of the recurring payment to be cancelled.

Returns

The call will return true if the recurring payment was successfully cancelled.


Get Missed Recurring Payment Data​

This call will return details you need to display the proper amount to the customer to catch up on missed payments for a recurring payment.

{
missedRecurringPaymentData(recurring_id: String) {
fee
number_of_payments_missed
total_amount_owed
}
}

Parameters

Keytypedescription
recurring_idStringThe recurring_id of the recurring payment to get missed payment data for.

Returns

Keytypedescription
feeIntIf the recurring payment has fee_mode set to SERVICE_FEE, this will be the total amount of fees that will be charged to the customer to payoff the missed payments.

If the recurring payment has fee_mode set to MERCHANT_FEE, this will be 0.
number_of_payments_missedIntThe number of payments that have been missed.
total_amount_owedIntThe total amount that the customer will owe to payoff the missed payments.

Create Retry for Failed Recurring Payment​

This call will allow you to retry a payment for a recurring payment that is in a Failed state. This should be used when the state is INSTRUMENT_FAILURE and the issue with the payment method has been addressed. EX: Payment failed for insufficient funds on the card, but the customer has since made a payment on the balance to resolve the issue.

mutation {
createRetryForFailedRecurringPayment(recurring_id: "")
}

Parameters

Keytypedescription
recurring_idStringThe recurring_id of the recurring payment to be retried.

Returns

The call will return true if the retry was successfully created.