function dinero_mail_reference()
 {
     $APIPassword = "******";
     $APIUserName = "******";
     $Crypt = false;
     $MerchantTransactionId = "1";
     $UniqueMessageId = "1";
     $Provider = "pagofacil";
     $Subject = "Subject";
     $Message = "Message";
     $Hash = "";
     $Currency = "ARS";
     $Amount = "10.00";
     $Code = "A001";
     $Description = "000";
     $ItemName = "Test";
     $Quantity = "1";
     $Address = "Humboldt 2500";
     $City = "Buenos Aires";
     $Country = "Argentina";
     $Email = "*****@*****.**";
     $Name = "John";
     $LastName = "Doe";
     $Phone = "45550000";
     $ns = "https://sandboxapi.dineromail.com/";
     $wsdlPath = "https://sandboxapi.dineromail.com/DMAPI.asmx?WSDL";
     try {
         $Items = $Amount . $Code . $Currency . $Description . $ItemName . $Quantity;
         $Buyer = $Name . $LastName . $Email . $Address . $Phone . $Country . $City;
         $Hash = $MerchantTransactionId . $UniqueMessageId . $Items . $Buyer . $Provider . $Subject . $Message . $APIPassword;
         $Hash = MD5($Hash);
         $MerchantTransactionId = encryptTripleDES($APIPassword, $MerchantTransactionId);
         $UniqueMessageId = encryptTripleDES($APIPassword, $UniqueMessageId);
         $Provider = encryptTripleDES($APIPassword, $Provider);
         $Subject = encryptTripleDES($APIPassword, $Subject);
         $Message = encryptTripleDES($APIPassword, $Message);
         $Currency = encryptTripleDES($APIPassword, $Currency);
         $Amount = encryptTripleDES($APIPassword, $Amount);
         $Code = encryptTripleDES($APIPassword, $Code);
         $ItemName = encryptTripleDES($APIPassword, $ItemName);
         $Quantity = encryptTripleDES($APIPassword, $Quantity);
         $Address = encryptTripleDES($APIPassword, $Address);
         $City = encryptTripleDES($APIPassword, $City);
         $Country = encryptTripleDES($APIPassword, $Country);
         $Email = encryptTripleDES($APIPassword, $Email);
         $Name = encryptTripleDES($APIPassword, $Name);
         $LastName = encryptTripleDES($APIPassword, $LastName);
         $Phone = encryptTripleDES($APIPassword, $Phone);
         $soap_options = array('trace' => 1, 'exceptions' => 1);
         $client = new SoapClient($wsdlPath, $soap_options);
         $credential = new SOAPVar(array('APIUserName' => $APIUserName, 'APIPassword' => $APIPassword), SOAP_ENC_OBJECT, 'APICredential', $ns);
         $Item = new SOAPVar(array('Amount' => $Amount, 'Code' => $Code, 'Currency' => $Currency, 'Description' => $Description, 'Name' => $ItemName, 'Quantity' => $Quantity), SOAP_ENC_OBJECT, 'Item', $ns);
         $Items = array($Item);
         $BuyerObject = new SOAPVar(array('Address' => $Address, 'City' => $City, 'Country' => $Country, 'Email' => $Email, 'LastName' => $LastName, 'Name' => $Name, 'Phone' => $Phone), SOAP_ENC_OBJECT, 'Buyer', $ns);
         $request = array('Credential' => $credential, 'Crypt' => $Crypt, 'MerchantTransactionId' => $MerchantTransactionId, 'UniqueMessageId' => $UniqueMessageId, 'Provider' => $Provider, 'Message' => $Message, 'Subject' => $Subject, 'Items' => $Items, 'Buyer' => $BuyerObject, 'Hash' => $Hash);
         $result = $client->DoPaymentWithReference($request);
         echo "<br/>";
         echo "MerchantTransactionId: " . $result->DoPaymentWithReferenceResult->MerchantTransactionId . "<br/>";
         echo "Status: " . $result->DoPaymentWithReferenceResult->TransactionId . "<br/>";
         echo "Message: " . $result->DoPaymentWithReferenceResult->Message . "<br/>";
         echo "Status: " . $result->DoPaymentWithReferenceResult->Status . "<br/>";
         echo "TransactionId: " . $result->DoPaymentWithReferenceResult->TransactionId . "<br/>";
         echo "BarcodeDigits: " . $result->DoPaymentWithReferenceResult->BarcodeDigits . "<br/>";
         echo "BarcodeImageUrl: " . $result->DoPaymentWithReferenceResult->BarcodeImageUrl . "<br/>";
         echo "VoucherUrl: " . $result->DoPaymentWithReferenceResult->VoucherUrl . "<br/>";
     } catch (SoapFault $sf) {
         echo "faultstring:" . $sf->faultstring;
     }
 }
Example #2
0
$UniqueMessageId = "1";
$Provider = "servipag";
$Currency = "MXN";
$Amount = "10.55";
$Hash = "";
$ns = 'https://sandboxapi.dineromail.com/';
$wsdlPath = "https://sandboxapi.dineromail.com/DMAPI.asmx?WSDL";
try {
    $Hash = $MerchantTransactionId . $UniqueMessageId . $Currency . $Amount . $Provider . $APIPassword;
    $Hash = MD5($Hash);
    if ($Crypt == true) {
        $MerchantTransactionId = encryptTripleDES($APIPassword, $MerchantTransactionId);
        $UniqueMessageId = encryptTripleDES($APIPassword, $UniqueMessageId);
        $Provider = encryptTripleDES($APIPassword, $Provider);
        $Currency = encryptTripleDES($APIPassword, $Currency);
        $Amount = encryptTripleDES($APIPassword, $Amount);
    }
    $soap_options = array('trace' => 1, 'exceptions' => 1);
    $client = new SoapClient($wsdlPath, $soap_options);
    $credential = new SOAPVar(array('APIUserName' => $APIUserName, 'APIPassword' => $APIPassword), SOAP_ENC_OBJECT, 'APICredential', $ns);
    $request = array('Credential' => $credential, 'Crypt' => $Crypt, 'MerchantTransactionId' => $MerchantTransactionId, 'UniqueMessageId' => $UniqueMessageId, 'Provider' => $Provider, 'Amount' => $Amount, 'Currency' => $Currency, 'Hash' => $Hash);
    $result = $client->GetPaymentTicket($request);
    echo "<br/>";
    echo "MerchantTransactionId: " . $result->GetPaymentTicketResult->MerchantTransactionId . "<br/>";
    echo "Status: " . $result->GetPaymentTicketResult->TransactionId . "<br/>";
    echo "Message: " . $result->GetPaymentTicketResult->Message . "<br/>";
    echo "Status: " . $result->GetPaymentTicketResult->Status . "<br/>";
    echo "TransactionId: " . $result->GetPaymentTicketResult->TransactionId . "<br/>";
    echo "BarcodeDigits: " . $result->GetPaymentTicketResult->BarcodeDigits . "<br/>";
    echo "BarcodeImageUrl: " . $result->GetPaymentTicketResult->BarcodeImageUrl . "<br/>";
    echo "VoucherUrl: " . $result->GetPaymentTicketResult->VoucherUrl . "<br/>";