Skip to main content

Payment Plans

Payment plans represent recurring or scheduled billing arrangements. Templates are reusable plan definitions; plans are customer-specific instances created from a template or directly.


Payment Plan Templates

merchantApiPaymentPlanTemplateCreate

Create a reusable billing template tied to a transaction provider.

mutation CreateTemplate(
$providerId: String!
$data: MerchantPaymentPlanTemplateCreateSchema!
) {
merchantApiPaymentPlanTemplateCreate(
merchantTransactionProviderId: $providerId
data: $data
) {
id
name
amount
currency
renewalIntervalMonths
endsAfterMonths
trialPeriodDays
providerStatus
providerCode
createdAt
updatedAt
}
}

Top-level arguments

ArgumentTypeRequiredDescription
merchantTransactionProviderIdStringYesID of the merchant transaction provider
dataMerchantPaymentPlanTemplateCreateSchemaYesTemplate definition

MerchantPaymentPlanTemplateCreateSchema fields

FieldTypeRequiredDescription
nameStringYesHuman-readable template name
amountBigIntYesRecurring charge amount in smallest currency unit (e.g. cents)
initialAmountBigIntYesFirst-payment amount (set equal to amount when there is no different first charge)
currencyCURRENCYYesISO 4217 currency enum (e.g. USD)
providerStatusPAYMENT_PLAN_TEMPLATE_STATUSYesInitial status: ENABLED or DISABLED
renewalIntervalDaysIntYesDays component of the renewal interval (0 if unused)
renewalIntervalMonthsIntYesMonths component of the renewal interval (0 if unused)
renewalIntervalYearsIntYesYears component of the renewal interval (0 if unused)
endsAfterDaysIntYesDays component of the plan duration (0 if unused)
endsAfterMonthsIntYesMonths component of the plan duration (0 if unused)
endsAfterYearsIntYesYears component of the plan duration (0 if unused)
trialPeriodDaysIntYesDays component of the trial period (0 if no trial)
trialPeriodMonthsIntYesMonths component of the trial period (0 if no trial)
trialPeriodYearsIntYesYears component of the trial period (0 if no trial)
descriptionStringNoOptional template description
providerParentTemplateCodeStringNoProvider's parent template code, when applicable
note

As with plan creation, the renewalInterval*, endsAfter*, and trialPeriod* integers are each required — send all of them, using 0 for unused units. At least one renewalInterval* and one endsAfter* must be greater than 0.

Return shape

FieldTypeDescription
idStringAccruPay template UUID
nameStringTemplate name
amountBigIntRecurring amount
currencyCURRENCYCurrency
renewalIntervalMonthsIntMonths component of the renewal interval
endsAfterMonthsIntMonths component of the plan duration
trialPeriodDaysIntDays component of the trial period
providerStatusPAYMENT_PLAN_TEMPLATE_STATUSProvider-side status
providerCodeStringProvider's own template reference
createdAtDateTimeISOCreation timestamp
updatedAtDateTimeISOLast update timestamp

merchantApiPaymentPlanTemplateUpdate

Update a template's mutable fields. Changes apply to future plan renewals only; existing active plans are not retroactively modified.

mutation UpdateTemplate(
$providerId: String!
$templateId: String!
$data: MerchantPaymentPlanTemplateUpdateSchema!
) {
merchantApiPaymentPlanTemplateUpdate(
merchantTransactionProviderId: $providerId
merchantPaymentPlanTemplateId: $templateId
data: $data
) {
id
name
providerStatus
updatedAt
}
}

Top-level arguments

ArgumentTypeRequiredDescription
merchantTransactionProviderIdStringYesProvider ID
merchantPaymentPlanTemplateIdStringYesAccruPay template UUID to update
dataMerchantPaymentPlanTemplateUpdateSchemaYesFields to update

MerchantPaymentPlanTemplateUpdateSchema fields

FieldTypeRequiredDescription
nameStringNoNew template name
providerStatusPAYMENT_PLAN_TEMPLATE_STATUSNoENABLED or DISABLED

merchantApiPaymentPlanTemplateSyncOne

Pull the latest state for a template from the provider and update AccruPay's records.

mutation SyncTemplate($providerId: String!, $providerCode: String!) {
merchantApiPaymentPlanTemplateSyncOne(
merchantTransactionProviderId: $providerId
providerCode: $providerCode
) {
id
name
providerStatus
updatedAt
}
}

Arguments

ArgumentTypeRequiredDescription
merchantTransactionProviderIdStringYesProvider ID
providerCodeStringYesProvider's own template reference code

Payment Plans

merchantApiPaymentPlanCreate

Create a customer-specific payment plan, optionally from a template.

mutation CreatePlan(
$providerId: String!
$data: MerchantPaymentPlanCreateSchema!
) {
merchantApiPaymentPlanCreate(
merchantTransactionProviderId: $providerId
data: $data
) {
id
status
amount
currency
providerCode
renewalIntervalMonths
endsAfterMonths
trialPeriodDays
currentPeriodStart
currentPeriodEnd
createdAt
updatedAt
}
}

Top-level arguments

ArgumentTypeRequiredDescription
merchantTransactionProviderIdStringYesProvider ID
dataMerchantPaymentPlanCreateSchemaYesPlan definition

MerchantPaymentPlanCreateSchema fields

FieldTypeRequiredDescription
merchantInternalPaymentPlanCodeStringYesYour unique identifier for this plan
templateIdStringYesAccruPay template UUID; billing schedule source
paymentMethodIdStringYesStored payment method ID to charge on each renewal
amountBigIntYesRecurring charge amount in smallest currency unit
initialAmountBigIntYesFirst-charge amount (set equal to amount when there is no different first charge)
currencyCURRENCYYesCurrency enum (e.g. USD)
renewalIntervalDaysIntYesDays component of the renewal interval (0 if unused)
renewalIntervalMonthsIntYesMonths component of the renewal interval (0 if unused)
renewalIntervalYearsIntYesYears component of the renewal interval (0 if unused)
endsAfterDaysIntYesDays component of the plan duration (0 if unused)
endsAfterMonthsIntYesMonths component of the plan duration (0 if unused)
endsAfterYearsIntYesYears component of the plan duration (0 if unused)
trialPeriodDaysIntYesDays component of the trial period (0 if no trial)
trialPeriodMonthsIntYesMonths component of the trial period (0 if no trial)
trialPeriodYearsIntYesYears component of the trial period (0 if no trial)
merchantInternalPaymentPlanDescriptionStringNoOptional human-readable description
customerMerchantCustomerSelectorNoCustomer selector. If omitted, the customer is resolved from the payment method. When provided, merchantInternalCustomerCode is required within it.
note

The interval, duration, and trial integers (renewalInterval*, endsAfter*, trialPeriod*) are each required by the schema — send every field, using 0 for units you are not using (e.g. a monthly plan sets renewalIntervalMonths: 1 and the other renewalInterval* to 0). The plan's billing cadence is defined by the referenced templateId.

Return shape

FieldTypeDescription
idStringAccruPay plan UUID
statusPAYMENT_PLAN_STATUSINITIALIZING, ACTIVE, INACTIVE, CANCELED, ENDED, or ERROR
amountBigIntRecurring charge amount
currencyCURRENCYCurrency
providerCodeStringProvider's plan reference
renewalIntervalMonthsIntMonths component of the renewal interval
endsAfterMonthsIntMonths component of the plan duration
trialPeriodDaysIntDays component of the trial period
currentPeriodStartDateTimeISOStart of the current billing period
currentPeriodEndDateTimeISOEnd of the current billing period (the next charge boundary)
createdAtDateTimeISOCreation timestamp
updatedAtDateTimeISOLast update timestamp

merchantApiPaymentPlanCancel

Cancel an active plan. No further renewals will be charged after cancellation.

mutation CancelPlan($planId: String!, $providerId: String!) {
merchantApiPaymentPlanCancel(
merchantPaymentPlanId: $planId
merchantTransactionProviderId: $providerId
) {
id
status
updatedAt
}
}

Arguments

ArgumentTypeRequiredDescription
merchantPaymentPlanIdStringYesAccruPay plan UUID to cancel
merchantTransactionProviderIdStringYesProvider the plan belongs to

merchantApiPaymentPlanSyncOne

Pull the latest plan state from the provider by the provider's own reference code.

mutation SyncPlan($providerId: String!, $providerCode: String!) {
merchantApiPaymentPlanSyncOne(
merchantTransactionProviderId: $providerId
providerCode: $providerCode
) {
id
status
currentPeriodEnd
updatedAt
}
}

Arguments

ArgumentTypeRequiredDescription
merchantTransactionProviderIdStringYesProvider ID
providerCodeStringYesProvider's plan reference code

Read queries

Fetch plans and templates. Single-record queries take an AccruPay ID; list queries return a pagination connection (edges { node }, pageInfo, totalCount).

QueryTypeArgsReturns
merchantApiPaymentPlanquerymerchantPaymentPlanId: String!MerchantPaymentPlan!
merchantApiPaymentPlansqueryfilters: id, transactionProviderId/transactionProvider, currency, providerCode, providerStatus, paymentMethodId, paymentMethod, templateId, customerId, merchantInternalCustomerCode, merchantInternalPaymentPlanCode, hasProviderError, started/ended/canceled, pagination (skip/take/after/first/before/last), sortingMerchantPaymentPlanPaginationConnection!
merchantApiPaymentPlanTemplatequerymerchantPaymentPlanTemplateId: String!MerchantPaymentPlanTemplate!
merchantApiPaymentPlanTemplatesqueryfilters: id, transactionProviderId/transactionProvider, name, currency, providerCode, providerParentTemplateCode, providerStatus, pagination, sortingMerchantPaymentPlanTemplatePaginationConnection!
query GetPlan($merchantPaymentPlanId: String!) {
merchantApiPaymentPlan(merchantPaymentPlanId: $merchantPaymentPlanId) {
id
status
amount
currency
currentPeriodEnd
}
}

Bulk sync (reconciliation)

Pull and reconcile all plans or templates for a provider in one call — for bulk reconciliation instead of per-record syncOne.

mutation SyncAllPlans($merchantTransactionProviderId: String!) {
merchantApiPaymentPlanSyncAll(merchantTransactionProviderId: $merchantTransactionProviderId) {
id
status
providerCode
}
}

mutation SyncAllTemplates($merchantTransactionProviderId: String!) {
merchantApiPaymentPlanTemplateSyncAll(merchantTransactionProviderId: $merchantTransactionProviderId) {
id
providerStatus
providerCode
}
}
MutationArgReturns
merchantApiPaymentPlanSyncAllmerchantTransactionProviderId: String![MerchantPaymentPlan!]!
merchantApiPaymentPlanTemplateSyncAllmerchantTransactionProviderId: String![MerchantPaymentPlanTemplate!]!
note

Both return a plain array (not a connection) and have no Node SDK wrapper — call them as raw GraphQL. The SDK exposes only syncOne.