Showing posts with label direct payment. Show all posts
Showing posts with label direct payment. Show all posts

Sunday, January 26, 2014

eWay xml and direct payment url, account and credit card details


eWayServiceLinkURL:
 TEST: https://www.eway.com.au/gateway/ManagedPaymentService/test/managedCreditCardPayment.asmx
 LIVE: https://www.eway.com.au/gateway/ManagedPaymentService/managedCreditCardPayment.asmx
 
eWayProcessPaymentURL:
 TEST: https://www.eway.com.au/gateway/managedpayment/ProcessPayment
 LIVE: https://www.eway.com.au/gateway/managedpayment/ProcessPayment
 
eWaySOAPActionURL
 TEST: https://www.eway.com.au/gateway/managedpayment
 LIVE: https://www.eway.com.au/gateway/managedpayment
 
eWayDirectPaymentURL:
 TEST: https://www.eway.com.au/gateway_cvn/xmltest/testpage.asp
 LIVE: https://www.eway.com.au/gateway/xmlpayment.asp
 
eWAYCustomerID:
 TEST: 87654321
 
Username:
 TEST: test@eway.com.au
 
Password:
 TEST: test123
 
Credit Card:
 TEST: 4444333322221111
 
Credit Card CVV:
 TEST: 123 (or any other 3 or 4 digit number)
 
Credit Card Expiry:
 TEST: 01/15 (any valid date)
 
Credit Card Name:
 TEST: test (or any other valid name)

Saturday, June 29, 2013

eWay transaction using php api direct payment

/* Pay using eWay */
function pay_using_eway()
{
    $testUrl = "https://www.eway.com.au/gateway_cvn/xmltest/testpage.asp";
    $liveUrl = "https://www.eway.com.au/gateway_cvn/xmlpayment.asp";
    $eWaySOAPActionURL = "https://www.eway.com.au/gateway/managedpayment";
    $eWayCustomerId = "87654321"; /* test account */
    $eWayTotalAmount = 100; /* 1$ = 100 cent */
    $directXML = "<ewaygateway>".
        "<ewayCustomerID>".$eWayCustomerId."</ewayCustomerID>".
        "<ewayTotalAmount>".$eWayTotalAmount."</ewayTotalAmount>".
        "<ewayCustomerFirstName></ewayCustomerFirstName>".
        "<ewayCustomerLastName></ewayCustomerLastName>".
        "<ewayCustomerEmail></ewayCustomerEmail>".
        "<ewayCustomerAddress></ewayCustomerAddress>".
        "<ewayCustomerPostcode></ewayCustomerPostcode>".
        "<ewayCustomerInvoiceDescription></ewayCustomerInvoiceDescription>".
        "<ewayCustomerInvoiceRef> Invoice Reference </ewayCustomerInvoiceRef>".
        "<ewayCardHoldersName>Card Holder Name</ewayCardHoldersName>".
        "<ewayCardNumber>4444333322221111</ewayCardNumber>".
        "<ewayCardExpiryMonth>01</ewayCardExpiryMonth>".
        "<ewayCardExpiryYear>2015</ewayCardExpiryYear>".
        "<ewayCVN>123</ewayCVN>".
        "<ewayTrxnNumber></ewayTrxnNumber>".
        "<ewayOption1></ewayOption1>".
        "<ewayOption2></ewayOption2>".
        "<ewayOption3></ewayOption3>".
    "</ewaygateway>";

    $result = makeCurlCall(
        $testUrl, /* CURL URL */
        "POST", /* CURL CALL METHOD */
        array( /* CURL HEADERS */
            "Content-Type: text/xml; charset=utf-8",
            "Accept: text/xml",
            "Pragma: no-cache",
            "SOAPAction: ".$eWaySOAPActionURL,
            "Content_length: ".strlen(trim($directXML))
        ),
        null, /* CURL GET PARAMETERS */
        $directXML /* CURL POST PARAMETERS AS XML */
    );

    if($result != null && isset($result["response"])) {
        $response = new SimpleXMLElement($result["response"]);
        $response = simpleXMLToArray($response);
        print_r2($response);
    }
    die("");
}

/* makeCurlCall */
function makeCurlCall($url, $method = "GET", $headers = null, $gets = null, $posts = null) {
    $ch = curl_init();
    if($gets != null)
    {
        $url.="?".(http_build_query($gets));
    }
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

    if($posts != null)
    {
        curl_setopt($ch, CURLOPT_POSTFIELDS, $posts);
    }
    if($method == "POST") {
        curl_setopt($ch, CURLOPT_POST, true);
    } else if($method == "PUT") {
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
    } else if($method == "HEAD") {
        curl_setopt($ch, CURLOPT_NOBODY, true);
    }
    if($headers != null && is_array($headers))
    {
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    }
    $response = curl_exec($ch);
    $code = curl_getinfo($ch,CURLINFO_HTTP_CODE);

    curl_close($ch);
    return array(
        "code" => $code,
        "response" => $response
    );
}

/* Response */ 
Array
(
    [ewayTrxnStatus] => Array
        (
            [__cdata] => True
        )

    [ewayTrxnNumber] => Array
        (
            [__cdata] => 20466
        )

    [ewayTrxnReference] => Array
        (
            [__cdata] => 
        )

    [ewayTrxnOption1] => Array
        (
            [__cdata] => 
        )

    [ewayTrxnOption2] => Array
        (
            [__cdata] => 
        )

    [ewayTrxnOption3] => Array
        (
            [__cdata] => 
        )

    [ewayAuthCode] => Array
        (
            [__cdata] => 123456
        )

    [ewayReturnAmount] => Array
        (
            [__cdata] => 100
        )

    [ewayTrxnError] => Array
        (
            [__cdata] => 00,Transaction Approved(Test CVN Gateway)
        )

)
 
http://www.eway.com.au/developers/api/direct-payments