Payment Widget Support

Payment Widget Integration

You can easily integrate Alternative Payments' Payment Widget which enables all the necessary processes for making a fast, secure, simple and personalized checkout.

Click on "Pay with Alternative Payments" to see our Payment Widget in live mode. If you want to see how it works, you need to fill out the required fields to complete the transaction.


Payments processed by Alternative Payments® are Tokenized and use SSL Encryption. Sensitive payment information is automatically converted to a uniqe token which is sent to our secure servers for validation. All sensitive consumer data that should not be stored, transferred or logged on your server for security reasons is securely processed by our company with the highest PCI security standards.

Widget Flow

Local Payments Widget Flow

Supported Payment Options

SEPA Direct Debit
ideal payment method
giropay payment method
eps payment method
przelewy24 payment method
POLi Payment Method
SefetyPay Peyment Method

How to implement

To Create Test Account, please download to your widget folder on your server Alternative Payments php-sdk from our github page.

Next, you are required to add the following code to your page.

You must insert your API keys. After the registration process you will be provided with the API Test Keys and API Production Keys, the parameters needed for start accepting payments through our payment system.

NOTE: Production API Keys are avaliable once you are verified, and are used to proccess live transactions.

Where do I find my keys?

You can find your test and production API keys under the Development menu item in the Merchant Portal.

There you can find your:

1.Test Public Key & Test Secret Key

2.Production Secret Key & Production Public Key

<?php require_once 'ap-php-sdk/vendor/autoload.php';

use AlternativePayments\Config;

// Set Private and Public Key
Config :: setApiKey("abcdefghijkl123456");
$publicKey = "abcdefghijkl123456";

// Set API url
Config :: setApiUrl("");

$currency = "USD";
$amount = "9.54";

$productDescription = "Red T-shirt";

$successUrl = "";
$cancelUrl = "";

$error = '';
$success = '';
$formPost = $_POST;

// Function to get the client IP address
function get_client_ip() {
    $ipaddress = '';
    if (isset($_SERVER['HTTP_CLIENT_IP']))
        $ipaddress = $_SERVER['HTTP_CLIENT_IP'];
    else if(isset($_SERVER['HTTP_X_FORWARDED_FOR']))
        $ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
    else if(isset($_SERVER['HTTP_X_FORWARDED']))
        $ipaddress = $_SERVER['HTTP_X_FORWARDED'];
    else if(isset($_SERVER['HTTP_FORWARDED_FOR']))
        $ipaddress = $_SERVER['HTTP_FORWARDED_FOR'];
    else if(isset($_SERVER['HTTP_FORWARDED']))
        $ipaddress = $_SERVER['HTTP_FORWARDED'];
    else if(isset($_SERVER['REMOTE_ADDR']))
        $ipaddress = $_SERVER['REMOTE_ADDR'];
        $ipaddress = 'UNKNOWN';
    return $ipaddress;

if ($formPost) {
    try {
        //Check if js returns the token
        if (!isset($formPost["APToken"])){
            throw new Exception("The AP Token was not generated correctly");
        $customer = new \AlternativePayments\Model\Customer();
        $customer->setState(isset($formPost["APState"]) ? $formPost["APState"] : null);
        $customer->setAddress(isset($formPost["APAddress"]) ? $formPost["APAddress"] : null);
        $customer->setAddress2(isset($formPost["APAddress2"]) ? $formPost["APAddress2"] : null);
        $customer->setCity(isset($formPost["APCity"]) ? $formPost["APCity"] : null);
        $customer->setZip(isset($formPost["APZip"]) ? $formPost["APZip"] : null);
        $customer->setBirthDate(isset($formPost["APBirthDate"]) ? $formPost["APBirthDate"] : null);
        if (isset($formPost["APPhone"]))
        //fixed fields
        $transaction = new \AlternativePayments\Model\Transaction();
        $transaction->setAmount($amount * 100);

        if (isset($formPost["APPhoneVerificationPin"]) && isset($formPost["APPhoneVerificationToken"])){
            $phoneVerification = new \AlternativePayments\Model\PhoneVerification();

        $redirectUrls = new \AlternativePayments\Model\RedirectUrls();
        $result = \AlternativePayments\Transaction::post($transaction);
    //  var_dump($result);
        if (array_key_exists('Message', $result)) {
            $error = '<p>' . $result['Message'] . '</p>';
        else {
            $success = '<p>Your payment was successful.</p>';
            $resultArray = json_decode(json_encode($result), true);
            $selectedpaymentoption = $resultArray["payment"]["paymentOption"];
            switch ($selectedpaymentoption) {
                case "SEPA":
                    header('Location: '.$successUrl);
                    $redirectingurl = $resultArray["redirectUrl"];
                    header('Location: '.$redirectingurl);
    catch (Exception $e) {
        $error = 'Error: '.$e->getMessage();

You are required to embed the payment widget code to your page.

            var AP_BUTTONS = ['PaymentButton'];
        <form method="post">
                data-ap-button-text="Pay using Alternative Payments"
                data-ap-public-key="<?php echo $publicKey; ?>"
                data-ap-company-name="Alternative Payments"
                data-ap-description="<?php echo $productDescription; ?>"
                data-ap-amount="<?php echo $amount; ?>"
                data-ap-currency="<?php echo $currency; ?>"


We have also additional widget theme that can be set using additional paramater:


In your webpage include folowing javascript file:

<script src="" type="text/javascript"></script>