PHP code example of signifyd / signifyd-php

1. Go to this page and download the library: Download signifyd/signifyd-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

signifyd / signifyd-php example snippets



    // This might differ depending on the location of the file from which you your project
    


    // This might differ depending on the location of the file from which you your project
    Signifyd\Core\Api\CaseApi($settings);

    ....
    // Case data
    $caseData = [
        "purchase" => [
            // Data related to purchase event represented in this Case Creation request.
        ],
        "recipient" => [
            // Data related to person or organization receiving the items purchased.
        ],
        "card" => [
            // Data related to the card that was used for the purchase and its cardholder.
        ],
        "userAccount" => [
            //User account if exists before placing an orders these data values are details from that account. 
        ],
        "seller" => [
            // All data related to the seller of the product. 
        ]        
    ];
    $caseResponse = $caseApi->createCase($caseData);
    ....

    ....
    $case = \Signifyd\Models\CaseModel();
    // Purchase array data or Purchase Object
    $case->setPurchase($purchase);
    
    // Recipient array data or Recipient Object
    $case->setRecipient($recipient);
    
    // Card array data or Card Object
    $case->setCard($card);
    
    // userAccount array data or userAccount Object
    $case->setUserAccount($userAccount);
    
    // Seller array data or Seller Object
    $case->setSeller($seller);
    
    $caseResponse = $caseApi->createCase($case);

    ....
    $caseId = 123456789;
    $caseResponse = $caseApi->getCase($caseId);
    ....

    ....
    $fulfillmentData = [
        // Fulfilment data
    ];
    $caseResponse = $caseApi->addFulfillment($fulfillmentData);
    ....

    ....
    $paymentUpdate = new Signifyd\Models\PaymentUpdate([
        // Payment update data
    ]);

    // Add data to payment update
    $caseResponse = $caseApi->updatePayment($paymentUpdate);
    ....


    // This might differ depending on the location of the file from which you your project
    


    // This might differ depending on the location of the file from which you your project
    \Signifyd\Core\Api\GuaranteeApi($settings);

    ....
    $guarantee = new \Signifyd\Model\Guarantee(['caseId' => 123456]);
    $guaranteeResponse = $guaranteeApi->createGuarantee($quarantee);
    ....

    ....
    $quarantee = new \Signifyd\Model\Guarantee(['caseId' => 123456789]);
    $guaranteeResponse = $guaranteeApi->cancelGuarantee($quarantee);
    ....


    // This might differ depending on the location of the file from which you your project
    


    // This might differ depending on the location of the file from which you your project
    ew \Signifyd\Core\Api\WebhooksApi($settings);

    ....
    $valid = $webhooksApi->validWebhookRequest($request, $hash, $topic);
    ....

    ....
    $webhook1 = new \Signifyd\Model\Webhook([
        // Webhook data
    ]);
    $webhook2 = new \Signifyd\Model\Webhook([
        // Webhook data
    ]);
    $webhooks = [$webhook1, $webhook2];
    $webhooksBulkResponse = $webhooksApi->createWebhooks($webhooks);
    ....

    ....
    $webhook1 = new \Signifyd\Model\Webhook([
        // Webhook data
    ]);
    $webhook2 = new \Signifyd\Model\Webhook([
        // Webhook data
    ]);
    $webhooks = [$webhook1, $webhook2];
    $webhooksBulkResponse = $webhooksApi->updateWebhooks($webhooks);
    ....

    ....
    $webhooksBulkResponse = $webhooksApi->getWebhooks();
    ....

    ....
    $webhook = new \Signifyd\Model\Webhook([
        // Webhook data
    ]);
    $webhooksResponse = $webhooksApi->updateWebhook($webhook);
    ....

    ....
    $webhook = new \Signifyd\Model\Webhook([
        // Webhook data
    ]);
    $webhooksResponse = $webhooksApi->deleteWebhook($webhook);
    ....

    // instantiating the address model class
    $addressData = ['streetAddress' => '2 Brodway', '...'];
    $address = new \Signifyd\Models\Address($addressData);

    // instantiating the address model class
    $address = new \Signifyd\Models\Address();
    $address->setSteetAddress('2 Brodway');

    // instantiating the card model class
    $cardData = ['cardHolderName' => 'John Doe', '...'];
    $card = new \Signifyd\Models\Card($cardData);

    // instantiating the card model class
    $card = new \Signifyd\Models\Card();
    $card->setCardHolderName('John Doe');

    // instantiating the case model class
    $caseData = ['purchase' => new \Signifyd\Model\Purchase(), '...'];
    $caseModel = new \Signifyd\Models\CaseModel($caseData);

    // instantiating the case model class
    $caseModel = new \Signifyd\Models\CaseModel();
    $caseModel->setPurchase(new \Signifyd\Model\Purchase());

    // instantiating the discount code model class
    $discountCodeData = ['code' => '598218sdareqw74fds', '...'];
    $discountCode = new \Signifyd\Models\DiscountCode($discountCodeData);

    // instantiating the discount code model class
    
    $discountCode = new \Signifyd\Models\DiscountCode();

    // instantiating the guarantee model class
    $guaranteeData = ['caseId' => 1234567890];
    $guarantee = new \Signifyd\Models\Guarantee($guaranteeData);

    // instantiating the guarantee model class
    
    $guarantee = new \Signifyd\Models\Guarantee();

    // instantiating the payment update model class
    $paymentUpdateData = ['paymentGateway' => 'Authorizenet', '...'];
    $paymentUpdate = new \Signifyd\Models\PaymentUpdate($paymentUpdateData);

    // instantiating the payment update model class
    
    $paymentUpdate = new \Signifyd\Models\PaymentUpdate();

    // instantiating the product model class
    $productData = ['itemId' => 1251541, '...'];
    $product = new \Signifyd\Models\Product($productData);

    // instantiating the product model class
    
    $product = new \Signifyd\Models\Product();

    // instantiating the purchase address model class
    $purchaseData = ['orderSessionId' => '1121aseaa324321ahiuhfsdiuhaiufds', '...'];
    $purchase = new \Signifyd\Models\Purchase($purchaseData);

    // instantiating the purchase address model class
    
    $purchase = new \Signifyd\Models\Purchase();

    // instantiating the recipient model class
    $recipientData = ['fullName' => 'John Doe', '...'];
    $recipient = new \Signifyd\Models\Recipient($recipientData);

    // instantiating the recipient model class
    
    $recipient = new \Signifyd\Models\Recipient();

    // instantiating the seller model class
    $sellerData = ['name' => 'My company', '...'];
    $seller = new \Signifyd\Models\Seller($sellerData);

    // instantiating the seller model class
    
    $seller = new \Signifyd\Models\Seller();

    // instantiating the shipment model class
    $shipmentData = ['shipper' => 'Fedex', '...'];
    $shipment = new \Signifyd\Models\Shipment($shipmentData);

    // instantiating the shipment model class
    
    $shipment = new \Signifyd\Models\Shipment();

    // instantiating the team model class
    $teamData = ['teamId' => 1, '...'];
    $team = new \Signifyd\Models\Team($teamData);

    // instantiating the team model class
    
    $team = new \Signifyd\Models\Team();

    // instantiating the user account model class
    $userData = ['emailAddress' => '[email protected]', '...'];
    $userAccount = new \Signifyd\Models\UserAccount($userData);

    // instantiating the user account model class
    $userAccount = new \Signifyd\Models\UserAccount();

    // instantiating the webhook model class
    $webhookData = ['event' => '', 'url' => 'Your Url'];
    $webhook = new \Signifyd\Models\Webhook($webHookData);

    // instantiating the webhook model class
    $webhook = new \Signifyd\Models\Webhook();

$ php composer.phar 

$ php composer.phar 

$ php composer.phar install