F API תיעוד מפתחים ואוטמציה WEBHOOK – תקבול
Close

API תיעוד מפתחים ואוטומציה WEBHOOK

בתקבול ניתן למצוא API מקיף לסליקה וחשבוניות עם קודים לדוגמא ב JS .NET ו PHP.

התיעוד מאפשר למפתחים להטמיע את שירותי הסליקה והחשבוניות הדיגטיליות של תקבול במערכות המשלימות שלהם ובכך להשלים עם השירותים של תקבול את השירות שהם מבקשים לבנות.

למומחי אוטמציה תקבול בנתה אפליקציה בממשק אינטגרומט שמאפשר לחבר את תקבול להרבה מערכות קיימות של CRM דיוור וניהול עסק.

יכולות API תקבול

WEBHOOK

WEBHOOK הוא חבילת מידע שמיוצרת על ידי מערכת תקבול מתפעול פעולות שונות ונשלח למערכות אחרות להמשך תפעול ואוטומציה. את ה WEBHOOK ניתן לשלב במערכות כמו INTEGROMAT או לעבוד איתו עם מתכנת שיודע לקבל את המידע ולתרגם אותו למערכת אחרת של העסק להפעלת תהליך אוטומטי כמו שליחת מייל או הוצאת שליח. בתקבול תוכלו לקבל WEBHOOK שמכיל את כל הפרמטרים של חשבונית או עסקה שהתבצעה מאתר או מדף תשלום או מהפקת מסמכים מתוך תקבול. הWEBHOOK יכול להיות ספציפי על דף תשלום או אתר או כללי על כל החשבוניות שמופקות במערכת.

ממשק ל ANGULAR

תיעוד למפתחי PHP

<?php

 

class Takbull_API {

 

    /**

     * Takbull API Endpoint

     */

    const ENDPOINT           = 'https://api.takbull.co.il/';

    const TAKBULL_API_VERSION = '1.0.0.1';

 

    /**

     * Secret API Key.

     * @var string

     */

    private static $api_secret = ";

 

    /**

     * Set secret API Key.

     * @param string $key

     */

    public static function set_api_secret( $api_secret ) {

        self::$api_secret = $api_secret;

    }

 

        /**

     * Secret API Key.

     * @var string

     */

    private static $api_key = ";

 

    /**

     * Set secret API Key.

     * @param string $key

     */

    public static function set_api_key( $api_key ) {

        self::$api_key = $api_key;

    }

 

    /**

     * Get secret key.

     * @return string

     */

    public static function get_api_secret() {

        if ( ! self::$api_secret ) {

            $options = get_option( 'woocommerce_takbull_settings' );

 

            if ( isset(  $options['api_secret'] ) ) {

                self::set_api_secret(  $options['api_secret'] );

            }

        }

        return self::$api_secret;

    }

 

    /**

     * Get secret key.

     * @return string

     */

    public static function get_api_key() {

        if ( ! self::$api_key ) {

            $options = get_option( 'woocommerce_takbull_settings' );

 

            if ( isset(  $options['api_key'] ) ) {

                self::set_api_secret(  $options['api_key'] );

            }

        }

        return self::$api_key;

    }

 

    public static function  get_redirecr_order_api(){

        return self::ENDPOINT."PaymentGateway";

    }

 

    /**

     * Generates the user agent we use to pass to API request so

     * Takbull can identify our application.

     *

     * @since 4.0.0

     * @version 4.0.0

     */

    public static function get_user_agent() {

        $app_info = array(

            'name'    => 'Takbull Gateway',

            'version' => TAKBULL_API_VERSION,

        );

 

        return array(

            'lang'         => 'php',

            'publisher'    => 'woocommerce',

            'uname'        => php_uname(),

            'application'  => $app_info,

        );

    }

 

    /**

     * Generates the headers to pass to API request.

     *

     * @since 4.0.0

     * @version 4.0.0

     */

    public static function get_headers() {

        $user_agent = self::get_user_agent();

        $app_info   = $user_agent['application'];

 

        return          array(

                'API_Secret'              =>self::get_api_secret(),

                'API_Key'              =>self::get_api_key(),

                'Takbull-Version'             => self::TAKBULL_API_VERSION,

                'User-Agent'                 => $app_info['name'] . '/' . $app_info['version'],

                'X-Takbull-Client-User-Agent' => json_encode( $user_agent ),

                'Content-Type' =>'application/json'

            

        );

    }

 

    /**

     * Send the request to Takbull's API

     *

     * @since 3.1.0

     * @version 4.0.6

     * @param array $request

     * @param string $api

     * @param string $method

     * @param bool $with_headers To get the response with headers.

     * @return stdClass|array

     */

    public static function request( $request, $api = 'charges', $method = 'POST') {

        $headers         = self::get_headers();

        

        $ch = curl_init(self::ENDPOINT . $api);

        # Setting our options

        curl_setopt($ch, CURLOPT_POST, 1);

        curl_setopt($ch, CURLOPT_POSTFIELDS, $request);

        curl_setopt($ch, CURLOPT_HTTPHEADER,  $headers);

        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

        # Get the response

        $response = curl_exec($ch);

        curl_close($ch);

        return $response;

    }

}

Order Json :

{

   "ex_order_reference": 83,

   "IPNAddress": " url instant payment notification",

   "RedirectAddress": "Url To redirect after deal charged",

   "CancelReturnAddress": " Url redirect to cancel(back to order)",

   "ShippingAmount": 0,

   "Products": [

      {

         "SKU": "32",

         "Description": "Beanie with Logo",

         "Price": 18,

         "Quantity": 2,

         "TaxAmount": 0,

         "Discount": 0

      },

      {

         "SKU": "15",

         "Description": "Beanie",

         "Price": 18,

         "Quantity": 2,

         "TaxAmount": 0,

         "Discount": 0

      },

      {

         "SKU": "17",

         "Description": "Cap",

         "Price": 16,

         "Quantity": 1,

         "TaxAmount": 0,

         "Discount": 0

      },

      {

         "SKU": "35",

         "Description": "Hoodie – Blue, Yes",

         "Price": 45,

         "Quantity": 5,

         "TaxAmount": 0,

         "Discount": 0

      }

   ],

   "Currency": "USD",

   "CustomerFullName": "Дудкина Алла",

   "Customer": {

      "CustomerFullName": "Дудкина Алла",

      "FirstName": "Дудкина",

      "LastName": "Алла",

      "Email": "youremail@gmail.com",

      "PhoneNumber": "0546317877",

      "Address": {

         "Address1": "youremail@gmail.com",

         "Address2": "",

         "City": "Bat Yam",

         "Country": "IL",

         "Zip": "123"

      }

   },

   "CustomerPhoneNumber": "0546317877",

   "OrderTotalSum": 313,

   "TaxAmount": 0,

   "Discount": 0,

   "Language": "en",

   "CreateDocument": true,

   "DisplayType": "iframe"

}

TAkbull RESPONE 83: stdClass Object

(

    [description] => Ok

    [responseCode] => 0

    [uniqId] => 6c44a50a-157f-4d7c-8a1b-65ba4369cdf5

)

https://api.takbull.co.il/PaymentGateway?orderUniqId=6c44a50a-157f-4d7c-8a1b-65ba4369cdf5

$url = "https://api.takbull.co.il/PaymentGateway?orderUniqId=6c44a50a-157f-4d7c-8a1b-65ba4369cdf5";

$html .= '<iframe id="wc_takbull_iframe" name="wc_takbull_iframe" width="100%" height="560px" style="border: 0;" src="'.$url.'"></iframe>' . PHP_EOL;

echo $html;

 

 

  • Customer will proceed to payment process
  • After success payment will redirect to provided success page
  • Takbull System will send notification to merchant IPN address (instant payment notification)
  • IPN contains takbull internal order-id ,

 mechant order-id, order status

Response : [body] => stdClass Object

        (

            [orderId] => 0

            [internalCode] => 0

            [internalDescription] => VERIFIED

            [providerCode] => 0

            [invoiceResponseCode] => 0

            [transactioninternalId] => 0

            [doNotRetry] => 

            [isSubscriptionPayment] => 

            [documentId] => 0

        )

  • internalCode !=0 means error
  • To Get order details: "https://api.takbull.co.il/api/ExtranalAPI/GetOrder?orderUniqId=XXXXXXXXXXXXXXXXXX"

<?php

function getiframe()
{
return '<iframe width="100%" height="560px" style="border: 0;" src="' . get_request_url() . '"></iframe>';
}

function get_request_url()
{
$data = get_data_from_order();
echo json_encode($data);
$response = json_decode(request(json_encode($data), "api/ExtranalAPI/GetTakbullPaymentPageRedirectUrl"));
if ($response->responseCode != 0) {
//return error
}

$endpoint = "https://api.takbull.co.il/PaymentGateway?orderUniqId=" . $response->uniqId;
//////
// THIS IS THE URL TO REDIREC\IFRAME TO
//////
return $endpoint;
}


function get_data_from_order()
{
$takbull_line_items = array(

//'SKU' => "123asd1", // Up to 12 characters that uniquely identify the product.
'Description' => "blue pill", // Up to 26 characters long describing the product.
'Price' => 117, // Cost of the product, in cents, as a non-negative integer.
'Quantity' => 1, // The number of items of this type sold, as a non-negative integer.
//'TaxAmount' => 17, // The amount of tax this item had added to it, in cents, as a non-negative integer.
'IsTaxteble' => true,
);

$customer = array(
'CustomerFullName' => "Neo",
'Email' => "thepne@matrix.com",
'PhoneNumber' => substr(strip_tags(preg_replace("/[^A-Za-z0-9]/", ", "9521234567")), 0, 10),
'Address' => array(
'Address1' => "Street #1",
'Address2' => "some where",
'City' => "Notherdam",
'Country' => "NeverLand",
'Zip' => "12311",
)
);
$level3_data = array(
'order_reference' => "some_ref_in_your_system", // An alphanumeric string of up to characters in length. This unique value is assigned by the merchant to identify the order. Also known as an “Order ID”.
// 'IPNAddress' => WC()->api_request_url('WC_Gateway_Takbull'), // PAYMENT NOTIFICATION CALLBACK FUNCTION
'RedirectAddress' => "http://localhost/success", // THIS IS THE URL CUSTOMER WILL BE REDIRECTED AFTER PAYMENT
// 'CancelReturnAddress' => esc_url_raw($order->get_cancel_order_url_raw()), // Please provide url that customer can go back (cart\chackout)
// 'ShippingAmount' => , // The shipping cost, in cents, as a non-negative integer.
// 'ShippingTaxAmount' => WC_Takbull_Helper::get_takbull_amount($order->get_shipping_tax(), $currency),
// 'Products' => $takbull_line_items,
// 'Currency' => get_woocommerce_currency(),
// 'CustomerFullName' => $customer_name,
'Customer' => $customer,
// 'CustomerPhoneNumber' => $order->get_billing_phone(),
'OrderTotalSum' => 117,

'Language' => "EN",
'CreateDocument' => true,
'Taxtable' => true,
'DisplayType' => 'iframe',
'MaxNumberOfPayments' => 5
);


return $level3_data;
}


function request($request, $api = 'charges')
{
$headers = array(
'API_Secret: 488447db-0503-4fc8-9ed0-4e1d62ee0114',
'API_Key: 95ed9b8d-8702-4c54-9dd8-b9242c7e3427',
'Content-Type: application/json',
"Accept-Encoding: gzip",
);
$ch = curl_init('https://api.takbull.co.il/' . $api);
# Setting our options
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
# Get the response
$response = curl_exec($ch);
curl_close($ch);
echo $response;
return $response;
}
?>


<html>

<head>
<title>PHP Test</title>
</head>

<body>
Payment iframe
<?php echo getiframe() ?>

</body>

</html>

מודול Integromat תקבול

מודול תקבול במערכת Integromat מאפשר לכול עסק לחבר בקלות מערכות דיוור ו CRM כמו ACTIVE TRAIL ופאואר לינק לסליקה וחשבוניות. ממשק אינטגרומט ותקבול עובד באמצעות וובהוק שמעדכן את כול המערכות של העסק בביצוע פעולה של סליקה והפקת חשבונית. חיבור אינטגרומט דורש ידע באוטומציה לכן אנחנו ממליצים ליצור איתנו קשר לחיבור למומחה בנושא.

חיבור API לחברות אתרים

חברת האתרים המובילה Wobily פיתחה חיבור עם API תקבול המאפשר מתוך מערכת WOBILY חיבור בקלות ללקוחותיה עם מערכת תקבול. כדי להפעיל את האתר של WOBILY לסליקה וחשבוניות של תקבול כול מה שצריך לעשות זה להכניס מפתחות של תקבול לממשק של מערכת האתרים ולסנכרן בין החשבונות. זה מאפשר למפעיל האתר להתחיל לעבוד מיידית ללא מתכנת או התערבות חיצונית.

API אפליקציה סמארט ביל

חברת יועצי המס ורואי חשבון סמארט ביל פיתחה ממשק API עם חברת תקבול וכיום ניתן לצלם את הוצאות העסק עם האפליקציה ולראות את תיעוד ההוצאות של העסק ישירות בממשק תקבול בדו"ח מסודר בצורה זאת בית העסק יכול לתת גישה ישירה לרואה החשבון לראות את תיעוד ההוצאות שלו.

לקבלת פרטים לגבי חיבור API ושיתופי פעולה צרו קשר ונחזור אליכם עם כול הפרטים