Adding a Custom Payment Gateway to RSVPMaker

RSVPMaker now supports two payment methods, PayPal and Stripe (via integration with the WP Simple Pay Lite for Stripe plugin), but I recently got a request from someone wanting to add an additional custom payment gateway. Now you can by using the hook ‘rsvpmaker_cash_or_custom’.

I’ve always tried to keep RSVPMaker developer-friendly for those who want to extend it. If you come up with something cool that ought to be part of the standard distribution, I hope you will consider contributing it to the project.

The new Default Payment Gateway heading on the settings page now includes 3 options: PayPal, Stripe, and Cash or Custom. The Cash or Custom setting can also be used by anyone who wants to display pricing on the website even if they will tell people to pay by cash or some other means, rather than paying online.

In the case where you are implementing a custom payment gateway, you would write a routine something like this.

Normally, what you would do in this space is output the payment button or other user interface code for the payment gateway functionality you are adding. This sample function just dumps all the data you get to work with related to the pricing and the information the user submitted about themselves, such as the email address for a confirmation message.

Want to add a custom payment method?

You would then take responsibility for handling the user’s submission. Ideally, you want to capture confirmation of the completed transaction and log the payment as complete in the RSVP report. Here is the function call.

In this example:

‘blockchain’ is the label for my custom payment method
$amount is the amount paid in this transaction
$rsvp_id is the ID for the event registration
$event is the post id ($post->ID)
$transaction_id is an optional transaction identifier, intended for an ID # you got back from the payment service

Here is what you get to work with (the output of the test function shown above, with an example user entry).

Charge

300

Invoice ID #

rsvp126102

Tracking # for payments

RSVP ID #

Unique ID for main database record for registration

5

Details

Details about the transaction

Profile

Details about the person

Post