Introduction

Introduction

Payson Checkout is a payment module that lets you receive payment through Payson’s payment system of the same name in your WooCommerce store.

In Payson Checkout, Payson has discarded all the extra steps at checkout. The payment window is directly integrated into your e-shop and lets your customers pay with a single click. All purchases are based on the service Invoice by email. The customer can pay for their purchase later, or immediately by card or internet bank.

Payson Checkout does not support the Checkout block i WooCommerce.
You can read more about this here.


Payson Account


To get started with Payson Checkout you will need an account with invoice purchasing activated. If you don’t have an account, you can open one here. Payson promises to have you up and running within 24 hours.


Test account


If you want to test the module before opening for actual purchases, you can create a test account here.

In addition to your test credentials from Payson you also need to activate Test mode in the plugin to complete testing purchases.

To mark a purchase as a test, you must use the following customer information:
Personal ID: 4605092222
Zip code: 99999

To complete a test purchase using a debit card, please use the following card details:
Card number: 4581 1111 1111 1112
Expiry date: Any date
CVC: Any number between 100 and 500

E-mail to use for the test account: testagent-1@payson.se

Payson only allows purchases over 10 SEK. An order with a lesser amount will show the error message “No other payment methods are available” instead of the Payson Checkout.


Installation


  1. Login to WordPress Admin. Navigate to Plugins → Add New (in the left column menu).
  2. Click on the Upload Plugin option, then click Browse to select the zip file from your computer. Once selected, press OK and press the Install Now button.
  3. Activate the plugin.

Required WordPress/WooCommerce settings


To enable the callback functionality, enabling Payson to send data back to your store, you must ensure your settings comply with the following:

  • Make sure that you have enabled pretty permalinks in your WordPress installation. Otherwise callbacks from Payson back to your store won’t work and orders will not be updated with the correct order status/information.
  • Callbacks do not work in a test environment that is not publicly accessible. If you are using a local development environment we recommend using a service similar to ngrok.
  • In some cases, firewalls and security software, such as Wordfence, can block server-to-server communication. If you are experiencing problems, try to temporarily disable your security measures to see if they might be interfering with Payson callbacks.
  • To get the order total to match between WooCommerce and Payson you need to configure WooCommerce to display prices with 2 decimals. More information about displaying of prices and how it can cause rounding issues can be found in this article.
  • Your checkout page must use the Classic Shortcode block. Payson Checkout does not support the Checkout block at this point. You can read more about this here.

Configuration


Before you get started you need to make sure you are using the checkout shortcode on your set Checkout Page.
The Checkout block is the default for new WooCommerce installations as of version 8.3. Payson Checkout for WooCommerce does not yet support this.

Go to Pages → your set Checkout Page and transform the Checkout block to the Classic Shortcode block.

  1. Go to: WooCommerce → Settings → Payments → Payson.
  2. Enable/Disable – Check this to enable Payson.
  3. Title – Enter the title for the payment method displayed in the checkout
  4. Description – Enter the description of the payment method displayed in the checkout page.
  5. Other payment method button text – Customize the Select another payment method button text that is displayed in checkout if using other payment methods than Payson Checkout. Leave blank to use the default (and translatable) text.
  6. Recurring invoice expiration time – Set the default expiration time, in days, for a recurring order invoice. This setting is only applicable if you are using WooCommerce Subscriptions.
  7. Agent ID – Enter your Agent ID as given to you by Payson.
  8. API Key – Enter the API Key given to you by Payson.
  9. Test mode – Check this to enable Payson Checkout test mode.
  10. Enable Order Management – Check this if you want to activate order handling in Payson directly from WooCommerce. This means that transactions that have their status changed from Processing to Cancelled in WooCommerce are canceled in Payson, and that completed transactions trigger an invoice from Payson (if applicable) when the status is set from Processing to Completed in WooCommerce.
  11. Color Scheme – Select which of the color schemes available from Payson to use.
  12. Debug Log – Check this to enable logging and save debug messages to the WooCommerce System Status log, found under WooCommerce → Status → Logs

Currencies


The Payson Checkout plugin supports SEK and EUR as these are the currencies supported by Payson.

Please note that there can be limitations in the agreement you have with Payson.

When it comes to questions regarding supported currencies you should always talk to your payment provider as any limitations within the plugin is set by the currencies the provider supports.

You can read more about this at the Payson website.


Currency with two decimal points


To make sure prices and sales tax for your products is communicated correctly between WooCommerce and Payson you have to ensure that the currency settings in WooCommerce is set to use two (2) decimal points. This is set under WooCommerce → Settings, in the General tab. The setting is called Number of decimals.

If you do not want integer prices to be shown with two decimal places (i.e 200.00kr), we have a code snippet in the post below. 

For details on why this is the case, please see our blog post on the subject.


Subscription support


Payson Checkout is compatible with the WooCommerce Subscriptions extension for handling of recurring payments in Sweden.

Read more about recurring payments here.


Pay for order / Manually adding an order


The Payson Checkout plugin supports the WooCommerce standard functionality to Manually Adding an Order from the WooCommerce admin.

This can also be referred to as “Pay for order” (or “Order pay”) and gives the merchant the possibility to create an order in the WooCommerce admin and then send a mail to the customer that includes a link to pay for the order.

This is useful if you accept phone orders, or for some other reason need to create an order with items, coupons and/or fees manually.

The merchant can set the payment method, and through that limit the method to Payson.

The customer information (address, email, phone etc.) initially entered by the admin overrides any information the customer might enter after following the link, so this is not a way for the customer to update any information, only to pay for an agreed order.


Order management


When an order is created in WooCommerce, and a reservation or transaction number exists in Paysons system, you can manage the order in Payson directly from WooCommerce.

Get started with order management

To get started with order management, activate the setting Enable order management in the modules settings.

Cancel an order

  1. Order status in WooCommerce must be Processing and a transaction ID must be saved in the order.
  2. Navigate to the order you wish to cancel by going to WooCommerce → Orders and clicking the order.
  3. In the order details, select the field labeled Status. Set this to Cancelled.
  4. Click the button labeled Update in the top right of the page.

If the cancelation is successful, a note is added to the order with the text Payson Checkout reservation was successfully cancelled.

Activate an order

  1. Order status in WooCommerce must be Processing and a transaction ID must be saved in the order.
  2. Navigate to the order you wish to activate by going to WooCommerce → Orders and clicking the order.
  3. In the order details, select the field labeled Status. Set this to Completed.
  4. Click the button labeled Update in the top right of the page.

If the activation was successful, a note is added to the order with the text Payson Checkout reservation was successfully activated.

Refunding an order

  1. Order status in WooCommerce must be Completed and a transaction ID must be saved in the order.
  2. Navigate to the order you wish to refund by going to WooCommerce → Orders and clicking the order.
  3. In the  Order items box, press the Refund button.
  4. Here you can choose to refund the full sum for an item (1), part of the sum (2) or shipping (3).
    If you enter a sum manually (2) you also need to enter the correct tax to refund manually, as opposed to when you refund the full sum for an item in which case the tax is automatically calculated. With shipping (3) you need to enter the amount manually, as well as the tax.  Not to be confused with the Refund manually button.
  5. Click Refund via Payson

If the refund was successful, a note is added to the order with the text Payson Checkout reservation was successfully refunded.


Change default country of the Payson Checkout form


Use the following snippet if you want to change the default country of the Payson Checkout form. You can find a list of all alpha-2 country codes here.

Note: The country code is limited to the countries that Payson Checkout supports.

/**
 * Change the country when the customer first visits the checkout page.
 *
 * @param array $request_args The request object.
 * @return void
 */
function force_pco_country( $request_args ) {
    $body = json_decode( $request_args['body'], true );
    /* For example, if we want to set the country to Denmark, the country code is "DK" (based on the ISO 3166-1 alpha-2 standard). */
    $body['customer']['countryCode'] = 'DK';
    $request_args['body']            = wp_json_encode( $body );
    return $request_args;
}
add_filter( 'pco_create_order_args', 'force_pco_country' );

Files to exclude from optimization


If you are using some kind of optimization feature there are files that needs to be excluded from any caching or concatenating.

For Payson Checkout for WooCommerce you need to exclude the following files:

  • wp-content/plugins/krokedil-paysoncheckout-20-for-woocommerce/assets/js/pco_checkout.js
  • wp-content/plugins/krokedil-paysoncheckout-20-for-woocommerce/assets/css/pco_style.css
  • Files from https://test-www.payson.se
  • Files from https://embedded.payson.se
  • Files from https://account.payson.se

Troubleshooting


If the checkout section is not shown after you have completed the steps as detailed here, and there are no error message, it is recommended that you temporarily enable WP_DEBUG in wp-config.php. Read more about WordPress debugging here.

This will provide more information that you can use to solve the problem, or that you can provide when reporting the problem to us. This information will help us assist you further.


Compatibility with themes and other plugins


Payson Checkout uses its own template file for displaying the checkout page and should work with most themes. However, the plugin is only tested with the Storefront theme and we do not guarantee that it will work with other themes. Common situations when errors occur are:

– Themes/plugins with customized template files for WooCommerce checkout page.

– Themes/plugins that modifies the checkout into a multi step checkout.

We always recommend you test a theme before using that theme in your live store. If required, contact the developer of your shop for assistance in making modification. 
Krokedil does not offer assistance in modifying your theme or plugin as part of our regular support.