Table of Contents

CashNet - Technical Specification

Objective

Adopting CashNet payment processor to the Learnexa checkout process. Enabling CashNet for credit card payments.

Functionality

Adding CashNet as an additional payment processor where Clients cannot use WePay or PayPal. Therefore, the Learnexa checkout process needs to be modified to enable CashNet for credit card payments.

Workflow

Merchant account set up

Provide an option in merchant account page to set up cashnet as the payment gateway.
Once cashnet is selected, user has to configure Cashnet in learnexa by providing the below required details:

  1. Merchant code
  2. Client code [This will be generated by learnexa and displayed to the user for the user to configure the same as the cashnet store notification url]
  3. Customre ID
  4. PMT CODE

DB Changes

  1. Merchant code can be saved to the existing “account_id” column
  2. 2 columns have to be added to Merchant account table
Column_name type Description
client_code varchar Column to hold the client url (store notification url)
customer_id varchar Column to hold custcode to make the purchase
pmt_code varchar Column to hold pmtcode to make the purchase

Model level Changes

  1. Create a new model, cashnet_account.rb
class CashnetAccount < MerchantAccount

end

Disable product monthly subscription

Since cashnet doesnt provide an option similar to wepay's preapproval, we would not be able to support product monthly subscription using cashnet.

If the merchant account of the site is of type cashnet, then product monthly subscription option in pricing options page should be disabled.

Product purchase flow

Once the pay button in the cart is clicked, follow the similar procedure as we do for other payment methods.

params = {
:merchant => merchant_code,
:client => client_code (something like: cashnet_order_checkout_success_url(payer.params_for_url_path(true, true))),
:ref1type1 => order_id (We can provide “reftype” and “refval” fields and values in the request if they need to be received in the response),
:ref1val1 => order.id,
:itemcnt => Total number of items in the cart,
:itemcode1 => itemcode 1,
:itemcode2 => itemcode 2,
..
:itemcoden => itemcode n,
:amount => total amount of the items in cart,
:qty => 1 (This will always be ‘1’ since there each item in the Learnexa cart is implicitly qty of 1.),
:custcode => customer id,
:pmtcode => pmtcode
}
https://commerce.cashnet.com/{MERCHANT_CODE}

Security

1. Implement a “shared secret”. This is a secret token/password that is known only to CASHNet and Learnexa server, and never exposed to the user. Learnexa will then only accept Store Notification messages that contain the shared secret. To implement the Store Notification shared secret:

 
         E.g. “shared-secret: 1n2bxn5h”
         
        E.g. “https://learnexa.com/cashnet/order_checkout_success/1n2bxn5h”.
        

2. Implement a “shared secret” for every payment request. This is a secret token/password that is specific to the payment object and never exposed to the user. Learnexa will then only accept Store Notification messages specific to the order only if it contain the shared secret specific to the payment object. To implement the Store Notification shared secret:

 
         E.g. “ref2type1 => 'shared_secret'”
         
 
         E.g. “ref2val1: O-order_id-P-payment_id-TS-payment_created_at”
         

3. Restricting the Store Notification URL so that it can only be called by CASHNet’s server IP addresses. Set postback-allowed-ip option in the config file. However, this is only viable if CASHNet can guarantee the ip address does not change.

Open questions

  1. I am not able to find a stage/sandbox site for cashnet to test the payment itegration.
  2. If a stage site is available we could try making payments and figure out:
    1. If we can implement lightbox way of handling payments.
    2. If cashnet sends out Store notification messages immediately after making the purchase.
    3. If there will be a chance for cashnet to chargeback the payment.
  3. Cashnet's server IP from which the Store notification URL will be sent is not known.

Reference

  1. Cashnet store settings - cashnetstoresettings.doc