Payment Widget Support

Payment Widget Integration

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

Click on "Pay with 2000Charge" 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 2000Charge® 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

How to implement

To Create Test Account, please download to your widget folder on your server 2000Charge 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 2000Charge\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 \2000Charge\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 \2000Charge\Model\Transaction();
        $transaction->setAmount($amount * 100);

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

        $redirectUrls = new \2000Charge\Model\RedirectUrls();
        $result = \2000Charge\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 2000Charge"
                data-ap-public-key="<?php echo $publicKey; ?>"
                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>