Create your own payment gateway

As of Shopkit v1.1, all payment gateways are defined in a standardized way within the site/plugins/shopkit/gateways folder.

Square, Stripe and PayPal are included. Here’s how to add your own gateway, if you want to give your customers another payment option:

Setting up the folder

  • Copy an existing gateway’s folder and rename it.
  • [blueprint details]

Sending data to the gateway

  • Open process.php. This is where your customers will be directed when they click Pay Now. Shopkit will pass along the $txn object so you can use that data.
  • A process.php should send the transaction data and payment information to the gateway.
  • Never collect users’ credit card information directly with the Shopkit server. All sensitive details should be handled by the gateway, either directly on their site, or through a SDK provided by them.
  • Make sure the gateway has a callback URL where it will send the transaction response. This should be /shop/cart/callback/[gatewayname]

Verifying order details

  • In callback.php, verify the charge against the pending order.
  • callback.php needs to update the transaction text file with 'status' => 'paid', the gateway transaction ID, and any customer details you might have
  • Make sure you include the order.callback snippet, which updates inventory and sends any required notifications.
  • If all is good, send the user along to http://example.com/shop/confirm, passing as many variables as you can to autofill the form (txn_id, payer_name, payer_email, payer_address).