A payment gateway.
This integration method integrates webpage defined in successURL parameter. Using Post Affiliate Pro API you can register a commission.
If you are already using successURL please continue with step 2.
If you do not use successURL parameter in your payment form/link you have to add it. If you do this, you have to modify the script which creates encryptedSignature for you, so it includes successURL too. The form line of code should look like this:
<input name="paymentCommand.successURL" value="http://www.yourshop.com/success" />
To successfully integrate GoPay you have to add a GET parameter with affiliate cookie value to the successURL parameter. You have to do this before encryptedSignature is created, as it would not match with the original successURL. If your successURL look like this:
the modified one have to look like this:
You have to set value of GET parameter 'custom' with value of cookie PAPVisitorId. You can do it e.g. using PHP $_COOKIE superglobal variable. The final link should look like this:
or with predefined account:
Last step is registration of sale commission. In your successURL file, at the place where you check if the transaction was paid successfully (GopaySoap::isEshopPaymentDone) you have to add our API code for creating a commission.
If the transaction is OK (opayHelper::PAYMENT_DONE), you have to load the transaction details and use it for the commission.
Here is an example API code:
<?php include_once('PapApi.class.php'); // path to your PAP4 API file $saleTracker = new Pap_Api_SaleTracker('https://URL_TO_PostAffiliatePro/scripts/sale.php'); $saleTracker->setAccountId('Account_ID'); $saleTracker->setVisitorId(substr($_GET['custom'],-32)); $sale = $saleTracker->createSale(); $sale->setTotalCost($order->total); // $order is supposed to be your shop variable $sale->setOrderID($_GET['variableSymbol']); $sale->setProductID($order->prodId); $saleTracker->register();