Adopting CashNet payment processor to the Learnexa checkout process. Enabling CashNet for credit card payments.
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.
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:
| 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 |
class CashnetAccount < MerchantAccount end
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.
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}
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.