Instant Payment Notification V2 (IPN)

What is IPN?

Instant Payment Notification (IPN) is a service that notifies you of events related to Paygol transactions. You can use it to automate back-office and administrative functions, such as fulfilling orders, inserting points or coins, upgrading membership, tracking customers, and providing status and other information related to a transaction.

 

Information about the payment

Paygol will make a GET request to your IPN file when your customer completes a transaction. You can use this notification to kick-off order fulfillment, enable digital media downloads, store information in a customer relationship management (CRM) or accounting system, and so on.

 

How to receive the IPN information in my web page?

Paygol provides samples of Instant Payment Notification (IPN) code for popular development environments. For custom IPN files, you can use the following sample code as a starting point.

 

Example of implementation

<?php 

use Paygol\Notification;

/**
 * Merchant service ID
 *
 * @var int
 */
$service_id = "123";
/**
 * Merchant shared secret
 *
 * @var string
 */
$shared_secret = "7c1a6a24-7943-102d-92f8-29573711ad31";

$ipn = new Notification($service_id, $shared_secret);

try {
    $ipn->validate();

    $params = $ipn->getParams();

    var_dump($params);
    
    // do something

    // Confirm reception
    $ipn->sendResponse(['OK'], 200);
} catch (\Exception $e) {
    $ipn->sendResponse(['error' => 'Validation error'], 400);
}

The above command returns JSON structured like this:

{
  "country": "ES",
  "currency": "USD",
  "custom": "Producto 1 - Producto 2 - Producto 3",
  "method": "teleingreso",
  "price": "10.00",
  "service_id": "123",
  "status": "completed",
  "transaction_id": "ZISS-A7Q8-RE2Z-S73W"
}

Notification handling

Handling notifications correctly is crucial to making sure your integration’s business logic works as expected.

 

Acknowledge notifications immediately

If your notification script performs complex logic, or makes network calls, it’s possible that the script would time out before Paygol sees its complete execution. Ideally, your notification handler code (acknowledging receipt of an event by returning a 2xx status code) is separate of any other logic you do for that event.

 

Handle duplicate notifications

IPN endpoints might occasionally receive the same notification more than once. We advise you to guard against duplicated notifications receipts by making your event processing idempotent. One way of doing this is logging the events you’ve processed, and then not processing already-logged events.

API Implementation

Overview
How to use the API Implementation
Parameter description
Payment methods
Search Payment Methods
Creating a Transaction
Transaction status
Status Definitions

 

Documentation for the implementation API v1.1.

Overview

Our API implementation offers a high level of customization, allowing you to implement an advanced white label payments solution directly on your platform in a fast and easy way.

This implementation is based in POST/GET requests to web-services which will return an JSON response. The response will contain a URL you can redirect your customer to in order to start the payment process.

How to use the API implementation

https://www.paygol.com/api/v2/

Parameters description

Payment methods

Name Coverage Code Description

Search Payment Methods

This function returns a list of valid payment methods for the requested country.

<?php

use \Paygol\API;
use \Paygol\Exceptions\InvalidParameterException;

/**
 * Merchant service ID
 *
 * @var int
 */
$service_id = "123";

/**
 * Merchant shared secret
 *
 * @var string
 */
$shared_secret = "7c1a6a24-7943-102d-92f8-29573711ad31";

try {
  $pg = new API($service_id, $shared_secret);

  $payment_methods = $pg->getPaymentMethods("de");

  var_dump($payment_methods);
} catch (\Exception $e) {
  die($e->getMessage());
}

Response

{
  "methods": {
    "creditcard": {
      "code": "creditcard",
      "name": "Credit Card",
      "image": "https://www.paygol.com/pay-now/images/method_button_creditcard.png"
    },
    "paysafecard": {
      "code": "paysafecard",
      "name": "Paysafecard",
      "image": "https://www.paygol.com/pay-now/images/method_button_paysafecard.png"
    },
    "bitcoin": {
      "code": "bitcoin",
      "name": "Bitcoin",
      "image": "https://www.paygol.com/pay-now/images/method_button_bitcoin.png"
    },
    "giropay": {
      "code": "giropay",
      "name": "Giropay",
      "image": "https://www.paygol.com/pay-now/images/method_button_giropay.png"
    }
  }
}


Creating a Transaction

Every single payment request in the API will generate a Transaction. Each Transaction is uniquely identified by Transaction ID. To obtain details about a Transaction you need to make a separate GET request.

<?php

use \Paygol\API;
use \Paygol\Models\Payer;
use \Paygol\Models\RedirectUrls;


/**
 * Merchant service ID
 *
 * @var int
 */
$service_id = "123";

/**
 * Merchant shared secret
 *
 * @var string
 */
$shared_secret = "7c1a6a24-7943-102d-92f8-29573711ad31";

try {
    $pg = new API($service_id, $shared_secret);

    $redirectUrls = new RedirectUrls();
    $redirectUrls->setRedirects(
        "https://www.my-site.com/success", 
        "https://www.my-site.com/failure"
    ); // optional

    $pg->setRedirects($redirectUrls);

    $pg->setCountry('DE');
    $pg->setPrice(11.00, 'EUR');
    $pg->setPaymentMethod('bitcoin');

    $payer = new Payer();
    $payer->setFirstName('John');
    $payer->setLastName('Doe');
    $payer->setEmail('[email protected]');
    $payer->setBIC('123423432');

    $pg->setPayer($payer);

    $payment = $pg->createPayment();

    var_dump( $payment );

    if (!empty($payment['data']['payment_method_url'])) {
        // do something
    }
} catch (\Exception $e) {
    die($e->getMessage());
}

The above command returns JSON structured like this:

{
  "data": {
    "service_id": "123",
    "transaction_id": "ABCD-ZZZZ-BIKE-R000",
    "status": "created",
    "payment_method": "bitcoin",
    "amount": "11.00",
    "currency": "EUR",
    "payment_method_url": "https://www.paygol.com/api/pay-direct/ABCD-ZZZZ-BIKE-R000",
    "custom":"internalID=918273645",
    "customer": {
      "first_name": "John",
      "last_name": "Doe",
      "email": "[email protected]",
      "phone": "5699334453",
      "personal_id": "111111111",
      "country": "CL"
    },
    "redirect_urls": {
        "success_url": "https://www.my-site.com/success",
        "cancel_url": "https://www.my-site.com/failure"
      }
  },
}

Transaction status

<?php

use \Paygol\API;

/**
 * Merchant service ID
 *
 * @var int
 */
$service_id = "123";

/**
 * Merchant shared secret
 *
 * @var string
 */
$shared_secret = "7c1a6a24-7943-102d-92f8-29573711ad31";

try {
    $pg = new API($service_id, $shared_secret);

    $status = $pg->getPaymentStatus('1234-5678-ABCD-EFGH');

    var_dump( $status );
} catch (\Exception $e) {
    die($e->getMessage());
}

The above command returns JSON structured like this:

{
  "payment": {
    "service_id": "123",
    "transaction_id": "1234-5678-ABCD-EFGH",
    "status": "created",
    "payment_method": "bitcoin",
    "amount": "11.00",
    "currency": "EUR",
    "created_at": "2019-05-30 22:01:46",
    "completed_at": null,
    "custom":"internalID=918273645",
    "customer": {
      "first_name": "John",
      "last_name": "Doe",
      "email": "[email protected]",
      "phone": "5699334453",
      "personal_id": "111111111",
      "country": "CL"
    }
  }
}

Status Definitions

Status Code Definition
Webcheckout

Web checkout implementation
Parameters description
Available Payment methods.

Web checkout Implementation

Below you will find a sample code for your payment button. Simply replace the example values as required and you’ll be ready to start receiving payments.

Parameters description

Parameter Type Description Requirement
pg_serviceid integer Service ID of your account. Mandatory
pg_price numeric The price of the product/service. Mandatory
pg_currency string Type of currency specified in alphabetic code ISO 4217 you want to use (eg: EUR, USD, GBP, MXN, etc.). See the full list of the currency codes. Mandatory
pg_country string Country of the payer, in ISO 3166-2 format (e.g. GB, DE, ES).
See the list of the country codes.
Mandatory
pg_language string Language, in ISO 639-1 format (e.g. en, es). If the provided language is not available, defaults to english. optional
pg_method string Payment method. Please check the table below for a list of available payment methods and their codes. For more information regarding each payment method, please check our Pricing page. Mandatory only for whitelabel checkout
pg_name string Description of your product/service, which will be shown on the payment screen. optional
pg_custom string Custom field, can be used to identify customer, inventory, etc. optional
pg_email string Email address of the payer. Mandatory only for whitelabel checkout
pg_phone string Phone number of the payer. Mandatory only for whitelabel checkout for some payment methods.
pg_first_name string First name of the payer. Mandatory only for whitelabel checkout
pg_last_name string Last name of the payer. Mandatory only for whitelabel checkout
pg_personalid string Local personal ID number of the payer. Mandatory only for whitelabel checkout for some payment methods
pg_sub_merchant_url string optional
pg_sub_merchant_id string optional
pg_return_url string After the payment process your customers will be redirected here (e.g. https://www.mysite.com/thanks). optional
pg_cancel_url string Your customer will be redirected to after a cancelled or failed payment process (e.g. https://www.mysite.com/failed). optional

Available Payment methods:

Name Code Description

Credit Card

pg_country Mandatory
pg_email Mandatory
pg_first_name Mandatory
pg_last_name Mandatory

Bitcoin

pg_country Mandatory
pg_email Mandatory
pg_first_name Mandatory
pg_last_name Mandatory

Webpay

pg_country Mandatory
pg_email Mandatory

Multicaja

pg_country Mandatory
pg_email Mandatory

Servipag

pg_country Mandatory
pg_email Mandatory

PagoEfectivo

pg_country Mandatory
pg_email Mandatory
pg_first_name Mandatory
pg_last_name Mandatory
pg_personalid Mandatory
pg_phone Mandatory

Pago Facil

pg_country Mandatory
pg_email Mandatory
pg_first_name Mandatory
pg_last_name Mandatory
pg_personalid Mandatory

Rapipago

pg_country Mandatory
pg_email Mandatory
pg_first_name Mandatory
pg_last_name Mandatory
pg_personalid Mandatory

Paysafecard

pg_country Mandatory
pg_email Mandatory
pg_first_name Mandatory
pg_last_name Mandatory

Giropay

pg_country Mandatory
pg_email Mandatory
pg_first_name Mandatory
pg_last_name Mandatory
pg_personalid Mandatory (Use this field for BIC)

iDEAL

pg_country Mandatory
pg_email Mandatory
pg_first_name Mandatory
pg_last_name Mandatory

Sofort

pg_country Mandatory
pg_email Mandatory
pg_first_name Mandatory
pg_last_name Mandatory

Przelewy24

pg_country Mandatory
pg_email Mandatory
pg_first_name Mandatory
pg_last_name Mandatory

Bancontact

pg_country Mandatory
pg_email Mandatory
pg_first_name Mandatory
pg_last_name Mandatory

Bradesco

pg_country Mandatory
pg_email Mandatory
pg_first_name Mandatory
pg_last_name Mandatory
pg_personalid Mandatory
pg_phone Mandatory (Format E.g.: 5531123456789)

OXXO

pg_country Mandatory
pg_email Mandatory
pg_first_name Mandatory
pg_last_name Mandatory
pg_personalid Mandatory

Itaú

pg_country Mandatory
pg_email Mandatory
pg_first_name Mandatory
pg_last_name Mandatory
pg_personalid Mandatory
pg_phone Mandatory (Format E.g.: 5531123456789)

Davivienda

pg_country Mandatory
pg_email Mandatory
pg_first_name Mandatory
pg_last_name Mandatory
pg_personalid Mandatory

Boleto

pg_country Mandatory
pg_email Mandatory
pg_first_name Mandatory
pg_last_name Mandatory
pg_personalid Mandatory

Redpagos

pg_country Mandatory
pg_email Mandatory
pg_first_name Mandatory
pg_last_name Mandatory
pg_personalid Mandatory

Santander Brasil

pg_country Mandatory
pg_email Mandatory
pg_first_name Mandatory
pg_last_name Mandatory
pg_personalid Mandatory
pg_phone Mandatory (Format E.g.: 5531123456789)

Santander México

pg_country Mandatory
pg_email Mandatory
pg_first_name Mandatory
pg_last_name Mandatory
pg_personalid Mandatory

Banco do Brasil

pg_country Mandatory
pg_email Mandatory
pg_first_name Mandatory
pg_last_name Mandatory
pg_personalid Mandatory
pg_phone Mandatory (Format E.g.: 5531123456789)

PSE

pg_country Mandatory
pg_email Mandatory
pg_first_name Mandatory
pg_last_name Mandatory
pg_personalid Mandatory

Efecty

pg_country Mandatory
pg_email Mandatory
pg_first_name Mandatory
pg_last_name Mandatory
pg_personalid Mandatory

ViaBaloto

pg_country Mandatory
pg_email Mandatory
pg_first_name Mandatory
pg_last_name Mandatory
Instant Payment Notification (IPN)

What is IPN?
Instant Payment Notification (IPN) is a service that notifies you of events related to Paygol transactions. You can use it to automate back-office and administrative functions, such as fulfilling orders, inserting points or coins, upgrading membership, tracking customers, and providing status and other information related to a transaction.

Information about the payment
Paygol will make a GET request to your IPN file when your customer completes a transaction. You can use this notification to kick-off order fulfillment, enable digital media downloads, store information in a customer relationship management (CRM) or accounting system, and so on.

How to receive the IPN information in my web page?
Paygol provides samples of Instant Payment Notification (IPN) code for popular development environments. For custom IPN files, you can use the following sample code as a starting point.

Example:

<?php 

$secret_key = "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeee";  // Enter secret key for your service. 

// Secret key validation 
if ($secret_key != $_GET['key']) {
    echo "Validation error"; 
    exit;
}

// get the variables from Paygol system
$transaction_id	   = $_GET['transaction_id'];
$service_id	       = $_GET['service_id'];
$country	          = $_GET['country'];
$custom	           = $_GET['custom'];
$price	            = $_GET['price'];
$currency  	       = $_GET['currency'];

// Here you can do whatever you want with the variables, for instance inserting or updating data into your Database 

IPN Parameters description

Customizable Webcheckout Page

The Customizable Webcheckout Page is designed to downplay our payment gateway and keep the focus on your business and your products. Your customers will remain engaged with your brand longer and we believe that this will decrease cart abandonment rates and increase sales.

Enabling your Customized Webcheckout Page

  • Sign into your Paygol Dashboard.
  • Go to the Account section in your dashboard and click on the Customization tab.
  • You will then see two drop boxes. The top box is designated for your Logo and the bottom box is designated for your Background image/design.
  • Upload an image file to one, or both, of the boxes (please keep in mind the “Max size” restrictions for uploading files).
  • Once the images are visible in your dashboard, you can click “Save.” The page will be refreshed and your customized Webcheckout page will be enabled.

 Some Things to Consider

  • Use the customizable Webcheckout page as an extension of your webshop. Try to maintain the same color scheme and design pattern as your webshop.
  • The payment widget will always be located in the center of the Webcheckout page. Try not to use a background image that will be obstructed by the payment widget.
  • The Webcheckout page is only seen when using the Webcheckout Integration or using a Paygol Module. The whitelabel checkout and API Integrations are designed to bypass the Webcheckout page.
  • Your logo will also be shown for certain payment methods that use printable vouchers (eg. PagoFacil). Convenient for webshops using the whitelabel checkout and API Integrations.

Jumpseller


Implementation of Paygol as a payment gateway

 

Paygol dashboard

  • Create a Paygol account and sign in.
  • Make sure that your account is in Live mode.
  • At the “Notifications” section you will find your Service ID and Secret Key, you will need them later so keep them at hand.

Jumpseller dashboard

  • Sign into your Jumpseller account.
  • Go to “Settings > Payments” and click “Add Payment Method”.
  • Choose “External Payment Gateway”
  • Enter “https://www.paygol.com/pay/jumpseller” as “Payment method URL”
  • Enter the Service ID of your Paygol account as Payment method key
  • Enter the Secret Key of your Paygol account as Payment method secret

Prestashop v1.7

Paygol module v1.0

 

About Paygol:

– Paygol is an online payment service provider that offers a wide variety of both worldwide and local payment methods.
– Additional information can be found at:
https://www.paygol.com/en
https://www.paygol.com/en/pricing

 

Requirements:

– Working Prestashop installation (tested with prestashop v1.7.1.10).
– Paygol account, you can register for free at https://secure.paygol.com/register.
– “Standard” type Paygol service (make sure to select “Integrated” in the service settings), which can be created at
https://www.paygol.com/en/webapps (you must be logged in).

Installation:

– Option 1 : upload the file via FTP, decompress the content of the “paygol_prestashop_v1.0.zip” file, directly in the file “modules” in your prestashop site.
– Option 2 : upload the file to the server via Prestashop. Please go to “modules and services”, add a new module, press “select a file”, look for the file in your computer (“paygol_prestashop_v1.0.zip”), press the botón “upload this module”, wait until the module is installed and then configurate
– Activate the module “Paygol” in your administration panel of Prestashop (modules and services, module list, look for the module “paygol”). Select install and configure. Then go to the configuration of Paygol module.
– In the configuration of the Paygol module you must enter:
– ID of your Paygol service (you can find this number in “my services” in you Paygol account)
– Secret key of your Paygol service (you can find this number in “my services” in you Paygol account)
– On the other hand, Paygol needs an URL address to do IPN. The URL that is in the box correspond to the address that you must enter in Paygol (My services, inside of the service, edit or change and enter the URL address in any box “URL background (IPN)”)
the URL address of IPN has the following things: “http://www.your-domain.com/prestashop/modules/paygol/paygol_ipn.php”. (please, replace the URL www.your-domain.com for the name of your domain. “Prestashop” is the instalation file of Prestashop and use the http/https as corespond )

Testing:

– To test the newly installed module you can enable your service’s “Test” mode at the “My Services” section of your panel,
at Paygol’s website. Be sure to change it back before going live.

Important Notes:

– While in test mode, an IPN request (payment notification) will be issued immediately after each test.
– Payments are usually notified immediately; however, certain payment methods may take longer to confirm the payment
(e.g. methods that take a few minutes to notify the transaction, or voucher-based transactions that require the payer
to print it in order to pay by cash at a given place). In these cases the product is shown as not paid, and only
once it’s confirmed by the provider will it show as paid. We strongly recommend that you inform your customers about this
beforehand in order to avoid confusions.

 

 

PrestaShop v1.6


Paygol module for PrestaShop, version 1.1

 

About Paygol:

 

Requirements:

  • Working PrestaShop installation (tested with PrestaShop v1.6.1.13,  v1.6.1.6  and  v1.6.1.0).
  • Paygol account, you can register for free at https://secure.paygol.com/signup.

 

Installation:

  • Download our PrestaShop module.
  • Option 1 : upload the file via FTP, decompress the content of the “paygol_for_prestashop_1.1.zip” file, directly in the file “modules” in your PrestaShop site.
  • Option 2 : upload the file to the server via PrestaShop. Please go to “modules and services”, add a new module, press “select a file”, look for the file in your computer (“paygol_for_prestashop_1.1.zip”), press the “upload this module” button, wait until the module is installed and then proceed with the setup.
  • Activate the module “Paygol” in your administration panel of PrestaShop (modules and services, module list, look for the module “paygol”). Select install and configure. Then go to the configuration of the Paygol module.
  • Enter both the Service ID and Secret Key of your Paygol account (can be found at the “Notifications” section of your Paygol dashboard).
  • Paste the provided URL into the IPN URL field at the “Notifications” section of your Paygol dashboard.

 

Testing:

  • To test the newly installed module, you can enable your account’s Test mode on top of your Paygol dashboard. Be sure to change it back before going live.

 

Important Notes:

  • While in test mode, an IPN request (payment notification) will be issued immediately after each test.
  • Payments are usually notified immediately; however, certain payment methods may take longer to confirm the payment (e.g. methods that take a few minutes to notify the transaction, or voucher-based transactions that require the payer to print it in order to pay by cash at a given place). In these cases the product is shown as not paid, and only once it’s confirmed by the provider will it show as paid. We strongly recommend that you inform your customers about this beforehand in order to avoid confusions.

 


Paygol module for BoxBilling, version 1.2

 

Requirements

 

Installation

  • Download BoxBilling module.
  • Unzip paygol-for-boxbilling_1.2.zip file directly into your BoxBilling directory.
  • Install your Paygol module using your BoxBilling admin dashboard (Configuration -> Payment Gateways -> New payment gateway), look for “Paygol” and click on “Install“.
  • Once installed, setup the module (Configuration -> Payment Gateways), select “Paygol” and click on Edit Icon (Pencil Icon).
  • Log into your Paygol Dashboard and go to “Notifications” section, copy the Service ID and Secret Key from your account and paste them into the corresponding fields at the module’s setup page on your BoxBilling site.
  • Copy the “IPN Callback URL” from your Paygol’s module setup and paste it into the “IPN URL” field at the “Notifications” section of your Paygol dashboard, then save the changes.
  • Make sure the module is configured as follows:
    • “Enabled: Yes“.
    • “Allow one time payments: Yes“.
    • “Enable test mode: No
  • Click on “UPDATE” on your BoxBilling site to save the changes.

 

Testing

To test the newly installed module you can enable your service’s test mode clicking the button “Live/Test” at the upper-right corner of your screen in your Paygol’s dashboard website, Be sure to change it back before going live.

 

Paygol button image

To ensure all instances of the Paygol button will work correctly, please follow these instructions:

  • Edit “logos.css” from your BoxBilling installation. This file can be found at “bb-themes/huraga/assets/css/logos.css“.
  • Add the following lines to the end of the file “logos.css“ and save changes:
    .logo-PayGol{
         background: transparent url("../img/gateway_logos/PayGol.png") no-repeat scroll 0% 0%;
         background-size: contain;
         width:80px;
         height: 28px;
         border: 0;
         margin: 10px;
    }
    

Please note:

If you are not using the default theme “huraga“, you need to do the following:

  • Modify the CSS file in the right folder, not inside “huraga“. e.g. “bb-themes/theThemeImUsing/assets/css/logos.css“.
  • Copy the logo image from “bb-themes/huraga/assets/img/gateway_logos/Paygol.png” to a similar path for the other theme.                                            e.g: “bb-themes/theThemeImUsing/assets/img/gateway_logos/Paygol.png“.
  • There’s an alternative way to the previous steps, just rename the folder “huraga” and name it as your new theme folder. This change should be done before you copy the Paygol module to your BoxBilling directory.

 

Important Notes

  • While in test mode, an IPN request (payment notification) will be issued immediately to your platform after each test.
  • Once a payment is completed it will be shown as completed but with “Pending Setup” status, until you activate it at your BoxBilling panel.
  • Payments are usually notified immediately; however, certain payment methods may take longer to confirm the payment (e.g. methods that take a few minutes to notify the transaction, or voucher-based transactions that require the payer to print it in order to pay by cash at a given place). We strongly recommend that you inform your customers about this beforehand in order to avoid confusions.
DonationCraft


How to enable Paygol as a payment gateway – DonationCraft

 

Paygol dashboard

  • Create a Paygol account and sign in.
  • Make sure that your account is in Live mode.
  • At the “Notifications” section, enter your IPN (eg. “http://shopname.enjin.com/paygol.php” ) into the IPN URL field ( your exact IPN can be found in your Enjin admin panel). You can also enter an email address so you can get payment notifications.
  • You will also find your Service ID and Secret Key, you will need them later so keep them at hand.

Enjin dashboard

  • Sign into your Enjin admin panel.
  • Go to “Modules > Donationcraft server store > Settings > Payments gateways”.
  • Select the Paygol gateway, click “accept payments through Paygol.com”, then enter the Service ID and Secret Key of your Paygol account.
  • Click “Save changes” to complete the setup.

You’re done!

You can now start accepting payments with Paygol!

 


Tebex Implementation

 

Paygol dashboard

  • Create a Paygol account and sign in.
  • Make sure that your account is in Live mode.
  • At the “Notifications” section, enter “https://www.tebex.io/ipn/paygol” into the IPN URL field. You can also enter an email address so you can get payment notifications.
  • You will also find your Service ID and Secret Key, you will need them later so keep them at hand.

Tebex dashboard

  • Sign into your Tebex account
  • Go to “Settings > Payment Gateways” in Tebex and click “Add Gateway”.
  • Select the Paygol gateway, then enter the Service ID and Secret Key of your Paygol account.
  • Choose to enable a price offset if you want to.
  • Click “Create” to complete the setup.

For more information, please check the Tebex documentation.


Paygol module for WooCommerce, version 1.3.3

 

Requirements

 

Installation

  • Log into your WooCommerce admin dashboard.
  • There’s 3 ways to install our plugin:
  1. Go to “Plugins -> Add new”, type on “paygol for woocommerce” in the “Search plugin” field and press “Install Now”. (RECOMMENDED)
  2. Download the plugin from the Official WordPress Plugins page, click “Upload plugin”, select the file from your computer and press “Install Now”.
  3. Download the plugin from the Official WordPress Plugins page, open your FTP and extract the plugin’s folder into wp-content/plugins/.
  • Go to “Plugins -> Installed Plugins” look for “Paygol plugin for Woocommerce” and press “Activate”.
  • Go to “WooCommerce->Settings->Checkout->Paygol” then log into your Paygol Dashboard and go to “Notifications” section, copy the Service ID and Secret Key from your account and paste them into the corresponding fields at the module’s setup page on your WooCommerce.
  • Copy the “Payments notification URL (IPN)” from your Paygol’s module setup and paste it into the “IPN URL” field at the “Notifications” section of your Paygol dashboard, then save the changes.
  • Click on “Save Changes” in your WooCommerce site.

 

Testing

To test the newly installed module you can enable your service’s test mode at the upper right screen of your dashboard, at Paygol’s website. Be sure to change it back before going live.

 

Important Notes

  • While in test mode, an IPN request (payment notification to your platform) will be issued immediately after each test.
  • Payments are usually notified immediately; however, certain payment methods may take longer to confirm the payment (e.g. methods that take a few minutes to notify the transaction, or voucher-based transactions that require the payer to print it in order to pay by cash at a given place). In these cases the product is shown as “Pending payment”, and only once it’s confirmed by the provider will it show as “Processing” (Wich it means that order is paid and waiting to be shipped). We strongly recommend that you inform your customers about this beforehand in order to avoid confusions.


Paygol module for OpenCart, version 4.3

 

Requirements

 

Installation

  • Download the Paygol OpenCart module.
  • Log into your OpenCart administration section.
  • Upload the file “paygol-for-opencart.1.2.ocmod.zip” (Extensions -> Installer -> Click “Upload“).
  • Install the Paygol module (Extensions -> Extensions -> Choose the extension type: “Payments” -> Search for “Paygol” -> Click “Install”), don’t close this page yet.
  • Select “Edit” (click on the pencil icon) to enter the module’s setup page.
  • Copy the “IPN URL” and paste it into the “IPN URL” field at the Notifications section of your Paygol dashboard, then save the changes.
  • At the Notifications section of your Paygol dashboard, copy the Service ID and Secret Key of your account and paste them into the corresponding fields at the module’s setup page.
  • Activate the module (change the “Status” option to “Enabled“)
  • Save the changes.

 

Testing

To test the newly installed module you can enable your account’s test mode by changing from “Live” to “Test” at your Paygol dashboard. Be sure to change it back when going live.

 

Important Notes

  • While in test mode, an IPN request (payment notification to your platform) will be issued immediately after each test.
  • Payments are usually notified immediately; however, certain payment methods may take longer to confirm the payment (e.g. methods that take a few minutes to notify the transaction, or voucher-based transactions that require the payer to print it in order to pay by cash at a given place). In these cases the product will not appear in the orders list until the payment is confirmed. We strongly recommend that you inform your customers about this beforehand in order to avoid confusions.
Basic Implementation

 

How to use the Basic Implementation
Parameters description
How to test your service


 


How to use the basic implementation

The code below is ready to use. Just copy the piece of code into your web page, replace the values with your own and you will be ready to go.

<form name="pg_frm" method="post" action="https://www.paygol.com/pay" >
   <input type="hidden" name="pg_serviceid" value="123">
   <input type="hidden" name="pg_currency" value="EUR">
   <input type="hidden" name="pg_name" value="DEMO">
   <input type="hidden" name="pg_custom" value="">
   <input type="hidden" name="pg_price" value="1">
   <input type="hidden" name="pg_return_url" value="">
   <input type="hidden" name="pg_cancel_url" value="">
   <input type="image" name="pg_button" src="https://www.paygol.com/pay-now/images/payment-button.png" border="0" alt="Make payments with Paygol: the easiest way!" title="Make payments with Paygol: the easiest way!" >     
</form>

Parameters description

The following POST/GET parameters are required:

How to test your implementation

On top of your Paygol dashboard you will be able to switch between Live and Test mode. In Test mode you can simulate transactions with no need to spend real money (just click OK on your payment screen and a successful payment will be simulated).

Please note that you don’t need to perform any external actions (such as entering credit card information) in order to test transactions.

 

Advanced implementation

 

Overview
How to use the advanced implementation
Parameters description


 


Overview

Our advanced implementation is a white label payments solution which allows you to redirect your customers directly to a local payment method with no need to open the Paygol payment screen.

How to use the advanced implementation

Below is a sample code for your payment button. Just replace any placeholder values as needed and you are ready to go.

<form name="pg_frm" method="post" action="https://www.paygol.com/pay" >
   <input type="hidden" name="pg_serviceid" value="123">
   <input type="hidden" name="pg_currency" value="EUR">
   <input type="hidden" name="pg_custom" value="">
   <input type="hidden" name="pg_price" value="1">
   <input type="hidden" name="pg_return_url" value="">
   <input type="hidden" name="pg_cancel_url" value="">
   <input type="hidden" name="pg_mode" value="advanced">
   <input type="hidden" name="pg_country" value="GB">
   <input type="hidden" name="pg_method" value="creditcard">
   Email: <input type="text" name="pg_email"><br><br>
   Name: <input type="text" name="pg_first_name"><br><br>
   Last name: <input type="text" name="pg_last_name"><br><br>
   Personal ID: <input type="text" name="pg_personalid"><br><br>
   <input type="image" name="pg_button" src="https://www.paygol.com/pay-now/images/payment-button.png" border="0" alt="Make payments with PayGol: the easiest way!" title="Make payments with PayGol: the easiest way!" >     
</form>

Parameters description

The following POST/GET parameters are required:

 

Codes for available payment methods:

Name Code Description

 

API Implementation

 

Overview
How to use the API Implementation
Parameters description
Checking the status of a payment


 

Documentation for the implementation API v1.2 is available.

Overview

Our API implementation offers a high level of customization, allowing you to implement an advanced white label payments solution directly on your platform in a fast and easy way.

This implementation is based in POST/GET requests to web-services which will return an XML or JSON response, according to your preference. The response will contain a URL you can redirect your customer to in order to start the payment process.

How to use the API implementation

To create a new payment you must make a request to the following URL:

https://www.paygol.com/pay

Parameters description

The following POST/GET parameters are required:

 

Codes for available payment methods:

Name Coverage Code Description

Example:

<?php

$endpoint_url = 'https://www.paygol.com/pay?';

$params = [
  'pg_mode'=>'api',
  'pg_serviceid'=>123,
  'pg_price'=>10.00,
  'pg_currency'=>'EUR',
  'pg_custom'=>'player123',
  'pg_country'=>'DE',
  'pg_language'=>'de',
  'pg_method'=>'creditcard',
  'pg_format'=>'json',
  'pg_ip'=>'123.13.12.13',
  'pg_email'=>'[email protected]',
  'pg_first_name'=>'josdhsn',
  'pg_last_name'=>'smitdh',
  'pg_personalid'=>'1234567238-6',
  'pg_return_url'=>'http://www.mysite.com/return.php',
  'pg_cancel_url'=>'http://www.mysite.com/cancel.php'
];

$buff = [];
foreach ($params as $k => $v) {
  array_push($buff, "{$k}={$v}");
}

$url = $endpoint_url . implode('&', $buff);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
$result = curl_exec($ch);
curl_close($ch);

$response = json_decode($result, true);

Reply JSON

{
    "data": {
        "service_id": "123",
        "transaction_id": "NDFF-PM4J-PVIA-CM1O",
        "status": "created",
        "payment_method": "creditcard",
        "amount": "10.00",
        "currency": "EUR",
        "payment_method_url": "https://www.paygol.com/api/pay-direct/NDFF-PM4J-PVIA-CM1O",
        "customer": {
            "first_name": "john",
            "last_name": "smith",
            "email": "[email protected]",
            "phone": "5531996145534",
            "personal_id": "58888854525",
            "country": "DE"
        },
        "redirect_urls": {
            "success_url": "http://www.mysite.com/return.php",
            "cancel_url": "http://www.mysite.com/cancel.php"
        }
    }
}

Reply in case of an error:

{
    "error": {
        "status": 400,
        "internal_code": "9702",
        "message": "Bad request - Invalid CPF"
    }
}

Reply (XML)

<transaction>
  <response>OK</response>
  <service>123</service>
  <payment_method>creditcard</payment_method>
  <payment_methods>creditcard,paysafecard,bitcoin,giropay,sofort</payment_methods>
  <id>NDFF-PM4J-PVIA-CM1O</id>
  <price>10.00</price>
  <currency>EUR</currency>
  <price_consumer>10.00</price_consumer>
  <currency_consumer>EUR</currency_consumer>
  <locale>es-CL</locale>
  <payment_method_url>https://www.paygol.com/api/pay-direct/NDFF-PM4J-PVIA-CM1O
</payment_method_url>
  <custom>player123</custom>
  <return_url>http://www.mysite.com/return.php</return_url>
  <cancel_url>http://www.mysite.com/cancel.php</cancel_url>
</transaction>

 

Reply in case of an error (example):

<transaction>
  <response>NOK</response>
  <error_message>Wrong country</error_message>
</transaction>

 

Reply parameters XML format.

Checking the status of a payment

To check the status of a payment you must make a request to the following URL:

https://www.paygol.com/api/check-payment

The following POST/GET parameters are required:

Example:

<?php

$endpoint_url = 'https://www.paygol.com/api/check-payment?';

$params = [
    'service'=>'123',
    'id'=>'N38K-WMP9-HUHM-Q6G7',
    'format'=>'json',
];

$buff = [];
foreach ($params as $k => $v) {
  array_push($buff, "{$k}={$v}");
}

$url = $endpoint_url . implode('&', $buff);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
$result = curl_exec($ch);
curl_close($ch);

var_dump(json_decode($result, true));

Reply (JSON)
Transaction ID was found, regardless of its current status:

{
    "data": {
        "service_id": "123",
        "transaction_id": "N38K-WMP9-HUHM-Q6G7",
        "status": "created",
        "payment_method": "itau",
        "amount": "5.00",
        "currency": "EUR",
        "created_at": "2019-04-08 00:21:00",
        "completed_at": null,
        "customer": {
            "first_name": "john",
            "last_name": "smith",
            "email": "[email protected]",
            "phone": "5531996145534",
            "personal_id": "58888854525",
            "country": "BR"
        }
    }
}

Reply in case of an error:

{
    "error": {
        "status": 404,
        "internal_code": "0302",
        "message": "Bad request - Transaction not found"
    }
}

Reply (XML)
Transaction ID was found, regardless of its current status (example):

<transaction>
  <response>OK</response>
  <status>completed</status>
</transaction>

Reply in case of an error (example):

<transaction>
  <response>NOK</response>
  <error_message>Transaction ID not found</error_message>
</transaction>

Reply parameters XML format.

Status Definitions

Completed-Consumer completed the payment process successfully and your account has been credited
Created-Consumer never completed the payment process, or the payment has not yet been registered by the payment method provider
Failed-Consumer attempted a payment but the payment method provider did not accept the payment 
Rejected-Paygol has rejected the payment, likely due to a notification from the payment method provider

Premium SMS implementation

Overview
IPN Start now
IPN Parameters description
IPN Use with your own parameters

 


 

Overview

As seen on TV an many others media you can create now your own marketing campaigns, polls, promotions, voting, and more. You can create your own keyword where your users can send text messages to.

For example: send TEXT to 1234

How does it work?
1. Users send a text message to your custom created keyword (e.g.: TEXT to 1234)
2. A pre-defined reply message by you will be sent back to the user (e.g.:Thanks for your message)
3. This payment will be charged to user’s mobile phone bill
4. You receive your earnings and a payment notification will be sent to you via e-mail

Some benefits:
– Immediate activation.
– No web site or any application required.
– Different price points per country.
– Great coverage.

 

IPN

What is IPN?
Instant Payment Notification (IPN) is a message service that notifies you of events related to Paygol transactions. You can use it to automate back-office and administrative functions, such as fulfilling orders, inserting points or coins, upgrading membership, tracking customers, and providing status and other information related to a transaction.

Information about the payment
Paygol makes a GET request to your IPN file when your customer completes the transaction. You can use this notification to kick-off order fulfillment, enable digital media downloads, store information in a customer relationship management (CRM) or accounting system, and so on.

How to receive the IPN information in my web page?
Paygol provides samples of Instant Payment Notification (IPN) code for popular development environments. Use working sample code to speed up your Paygol integrations.

This PHP sample code will just send you an e-mail everytime when a payment has been notified. Of course you can add your own funcionalities instead of just sending an email.

<?php 

$secret_key = "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeee";  // Enter secret key for your service. 

// Secret key validation 
if ($secret_key != $_GET['key']) {
    echo "Validation error"; 
    exit;
}

// get the variables from Paygol system
$service_id	= $_GET['service_id'];
$shortcode	 = $_GET['shortcode'];
$keyword	   = $_GET['keyword'];
$subkeyword	= $_GET['subkeyword'];
$message	   = $_GET['message'];
$sender	    = $_GET['sender'];
$operator	  = $_GET['operator'];
$country	   = $_GET['country'];
$price	     = $_GET['price'];
$currency	  = $_GET['currency'];
 
// Here you can do whatever you want with the variables, for instance inserting or updating data into your Database 

?>
 

IPN Parameters description

 

IPN Use with your own parameters

What if I need some information from my customer?
Sometimes you might need to receive input from the payer, such as his/her username. Our Premium SMS services are ready for this and will let the payer add parameters after the message, which you can then use in any way you need.

So, how does it work?
Just tell your customer to send the message followed by the parameter.
For example, let’s say that your Premium SMS instructions are “Send GOL VIP to 1234”: In this case, if someone sends “GOL VIP JOHN”, the ‘message’ GET parameter on the IPN will contain “JOHN”.

Can I get multiple parameters?
Sure! For example, a message with the text “GOL VIP JOHN SWORD” will return “JOHN SWORD” through the ‘message’ GET parameter.
You can use even more parameters if you need to.