Stripe for OpenCart. Configuration. Part 3
Webhooks is a term, defined by Stripe to describe URL endpoint of your store to send Stripe Dashboard notifications to. Stripe sends a notification on charge creation, payment fulfillment, subscription creation and much more. The extension utilizes some of them, e.g. notification about charge refund or subscription creation. So in order to an order status to be changed accordingly when a status of a charge is changed from Stripe Dashboard or to get track of all recurring payments in your store you need to set up webhook endpoint. To do it follow the link to the webhook management page of your Stripe Dashboard (figure 1) and fill in webhook URL into the corresponding input field (figure 2). To test webhook configuration send test webhook (figure 3). If webhook configured correctly then notification about webhook misconfiguration (top of the admin area of the extension) won’t be displayed anymore.
The extension extends the concept of webhooks by adding an option to send a notification to URL of your choice on subscription creation and subscription cancellation. This allows you to automate some actions, e.g. create an account when a new subscription is created and close the account when the subscription is canceled. To be notified on a subscription status change you need to fill in input field ‘Subscription creation callback’ to specify URL to send a notification to on subscription creation and ‘Subscription cancellation callback’ – to send notification on subscription cancellation (figure 1).
The notification has a form of POST query with the next data:
‘oc_customer’ – customer ID from your store;
‘stripe_customer’ – customer ID from your Stripe Dashboard;
‘oc_subscription’ – OpenCart subscription ID;
‘stripe_subscription’ – Stripe subscription ID;
‘status’ – subscription status: ‘new’ on subscription creation and ‘cancel’ on subscription cancellation;
You can specify additional data to be sent along with the default. To do it fill in ‘Creation callback data’ input field and ‘Cancellation callback data’ input field to send additional data on subscription creation and cancellation accordingly (figure 1). Data should be in a form of name1=value1;…;nameN=valueN
‘Plans’ tab allows you can delete or import Stripe’s recurring plans to OpenCart.
Click on the ‘Import plan button’ (figure 4) to import Stripe plan into OpenCart and appropriate recurring profile will be created automatically. If the button is gray it means that such plan already exists in OpenCart. Click the ‘Delete plan button’ to delete the profile from the Stripe Dashboard. Click the ‘Rename plan button’ to rename the profile in the Stripe Dashboard. You may optionally map a Stripe plan to an OpenCart profile. Normally the extension creates an appropriate profile in the Stripe Dashboard when the customer creates a new subscription. Sometimes it may lead to the plan duplication so it’s better to make the explicit mapping. To do it you need start typing profile name in the corresponding “OpenCart Recurring Profile” input and select a needed profile from the drop-down. After that, the lock button of the input will turn from gray to green. To unmap profile click that green lock button. You can map Stripe plan only if it has corresponding profile in OpenCart (the left arrow button of the corresponding Stripe plan input should be gray)
At this tab, you can create a rule to tune up a recurring payment: define which total fields should be present in the recurring part of a payment and which at the one-time part only, whether a recurring payment can be canceled by a customer etc. There are two predefined rules: “NonRecurring” – applied only to products with no recurring plans and affects an ordinary charge (figure 5), and “Default” – applied to the recurring payments. So, for example, you can define whether shipping or handling fees should be paid only once with the first payment or at each cycle of recurring payment.
Each rule has next options:
|Can be canceled by customer||Defines whether the recurring plan can be canceled by
a customer through its account (figure 7)
|Can be canceled immediately||Defines whether the subscription can be canceled immediately (by a customer, if the previous setting is enabled, or by the admin). If enabled – additional button will be displayed in the subscription management set (figure 7)|
|Consider product options||If enabled then recurring price will include additional price for each product option, e.g. color, size (figure 8)|
|Add ordinary product||This setting makes it possible to add to an order additional instance of a recurring product but instead of the recurring price, the ordinal price will be used (figure 8)|
At this tab, you can map (apply) specific rule (created at the tab ‘Rule’) to OpenCart recurring profile. Without explicit mapping, all recurring profiles implicitly mapped to the ‘Default’ rule (figure 9).
Through this tab, you can customize front-end captions in a multilanguage way without the need to directly modify translation file (figure 10).
‘Lost ordders’ tab
The OpenCart e-commerce solution is complicated ecosystem comprising along with core scripts a lot of third parties modules, so there is a chance that after customers’ card has been charged a script error can interrupt payment process and prevent an order placing from completion. It can make the customer believe that payment has failed and try to make another payment. The extension applies the algorithm to prevent it: if script error happens the extension will detect it, place an order and notify the customer about successful payment no matter what. All orders that were interrupted by script error will be placed into the table at ‘Lost orders’ tab (figure 11). Though the extension does its best to recover such orders sometimes it’s impossible to do it programmatically and you need to do it manually – you just need to follow the instructions from ‘Description’ column of the table.
Through ‘Support’ tab you can directly send a support request, get basic information concern the extension, manage cache, DB version data etc (figure 12).
If you have any question or idea email me at firstname.lastname@example.org or leave a comment