Skip to main content

Manage Recurring Payment Instructions Using the API

Create, update, and process Recurring Payment Instructions (RPIs) securely through the Donorfy API.

Cristina Gruita avatar
Written by Cristina Gruita
Updated over a month ago

Understand RPI API Limitations

When working with RPIs via the API, Donorfy acts as a record-keeping and processing system only.

  1. Donorfy does not create mandates or payment instructions with payment gateways.

  2. You must store any gateway IDs, tokens, or references returned by the payment processor.

Gateway references should be stored in CollectionReference1 to CollectionReference5 on the RPI.


Add or Update a Recurring Payment Instruction

When creating or updating an RPI, certain properties are mandatory and must match values in your Donorfy settings.

Required Properties

You must provide all of the following:

  1. Product – Must be a valid Product in settings.

  2. Campaign – Must be a valid Campaign in settings.

  3. Fund – Must be a valid Fund in settings.

  4. CollectionMethod – One of the built-in methods such as GoCardless, Stripe, Standing Order, or a custom method you created.

  5. RecurringPaymentInstructionType – RecurringDonation or Membership.

  6. StartOption – OnOrAfter or NextCollectionDay.

  7. EndOption – OpenEnded or NoPaymentsAfter.

  8. PaymentFrequency – HalfYear, Month, Quarter, or Year.

  9. CollectionReference1–5 – At least one reference must be supplied.

If a required option is not supplied, Donorfy applies default values where supported.


Configure Start and End Options

Start and end rules control when payments begin and stop.

Start Options

  1. Use OnOrAfter and provide a StartDate.

  2. Use NextCollectionDay to start automatically on the next cycle.

If no StartOption is provided, NextCollectionDay is used.

End Options

  1. Use OpenEnded for ongoing payments.

  2. Use NoPaymentsAfter and provide an EndDate.

If no EndOption is provided, OpenEnded is used.


Set Optional RPI Properties

You can include additional properties to control behaviour and reporting.

  1. DateAdded to backdate historic instructions.

  2. Channel, Currency, Department, BankAccount, or Acknowledgement, if valid in settings.

  3. CollectionDay, using a value from 1 to 31.

  4. StartMonth, using numbers where January equals 1.


Configure Gift Aid on RPIs

Gift Aid options can be applied when adding an RPI.

  1. Set CanRecoverTax to true to enable Gift Aid eligibility.

  2. Set AddGiftAidDeclaration to true to create a declaration if one does not already exist.

  3. Optionally set GiftAidDeclarationMethod, otherwise Web is used.

Gift Aid declarations are only added if the constituent does not already have one.


Link RPIs to Constituents

You can associate an RPI with a new or existing constituent.

  1. Provide ExistingConstituentId to link to an existing constituent.

  2. Omit ExistingConstituentId to create a new constituent automatically.

You can also specify a connected constituent or beneficiary when adding the RPI.


Perform Operations on Existing RPIs

Several actions are available for managing RPIs after creation.

Upgrade an RPI

Upgrading adds a new payment and allocation.

  1. Call the Upgrade endpoint for the RPI.

  2. Confirm the upgrade is applied successfully.

Change RPI Status

You can control the lifecycle of an RPI.

  1. Use Pause to temporarily stop collections.

  2. Use Cancel to end the RPI permanently.

  3. Use Activate to restart a paused RPI.


Record Successful Payments

If payments are collected outside Donorfy, you can record them manually.

  1. Call the PaymentCollected endpoint for the RPI.

  2. Provide the Month, Year, and Amount collected.

Optional fields include:

  1. ProcessingCosts charged by the gateway.

  2. CollectionDate, otherwise the current date is used.

  3. Reference and TransactionId from the payment gateway.

The TransactionId is the gateway reference, not a Donorfy transaction ID.


Understand Successful Payment Processing

When a successful payment is recorded, Donorfy processes it automatically.

  1. An expected payment is created if none exists.

  2. Existing expected or failed payments are reused.

  3. A payment report is created and shown on the RPI History tab.

  4. Overnight reconciliation adds a transaction to the constituent timeline.

Payments already marked as collected cannot be collected again.


Record Failed Payments

You can also record failed payment attempts.

  1. Call the PaymentFailed endpoint for the RPI.

  2. Provide the Month and Year of the failed payment.

  3. Optionally include a Failure Reason.

Donorfy then:

  1. Creates an expected payment if one does not exist.

  2. Marks the payment as failed.

  3. Adds an activity to the constituent timeline.

  4. Evaluates whether the RPI should be lapsed overnight.

⚠️Important:The Donorfy API is a Professional-only feature. Essential subscribers, please contact us to find out more about upgrading.

Did this answer your question?