Skip to main content
deleted 2576 characters in body
Source Link

Update

Here is the second argument I'm trying to pass

    $command = <<<XMLCOMMAND
<?xml version="1.0" encoding="UTF-8"?>
<JProxyPayLink>
<Message>
<Type>Capture</Type>
<Authentication>
<MerchantID>{$this->getMerchant()}</MerchantID>
<Password>{$this->getPassword()}</Password>
</Authentication>
<OrderInfo>
<Amount>{$this->getAmount()}</Amount>
<MerchantRef>{$this->getMerchantRef()}</MerchantRef>
<MerchantDesc />
<Currency>{$this->getCurrency()}</Currency>
<CustomerEmail>{$this->getCustomerEmail()}</CustomerEmail>
<Var1 />
<Var2 />
<Var3 />
<Var4 />
<Var5 />
<Var6 />
<Var7 />
<Var8 />
<Var9 />
</OrderInfo>
<PaymentInfo>
<CCN>{$this->getCardNumber()}</CCN>
<Expdate>{$this->getExpirationDate()}</Expdate>
<CVCCVV>{$this->getCertificationNumber()}</CVCCVV>
<InstallmentOffset>0</InstallmentOffset>
<InstallmentPeriod>0</InstallmentPeriod>
</PaymentInfo>
</Message>
</JProxyPayLink>
XMLCOMMAND;

And the data.

    $command = str_replace(PHP_EOL, '', $command);

    $data = ['APACScommand' => 'NewPayment','data' => $command];

    curl_setopt($this->handle, CURLOPT_POSTFIELDS, http_build_query($data));

Somehow it works for another APACScommand command but not for this.

Addendum

The structure. I've already initialize curl_init.

public function post() {
    curl_setopt($this->handle, CURLOPT_URL,$this->url);
    curl_setopt($this->handle, CURLOPT_RETURNTRANSFER, true);



    curl_setopt($this->handle, CURLOPT_VERBOSE, 1);
    curl_setopt($this->handle, CURLOPT_HEADER, 1);

    //
    curl_setopt($this->handle, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
    curl_setopt($this->handle, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($this->handle, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($this->handle, CURLOPT_POST, true);

    //http_build_query
    curl_setopt($this->handle, CURLOPT_POSTFIELDS, http_build_query($this->data));

    $this->result = curl_exec( $this->handle );
    
    $this->headerSize = curl_getinfo($this->handle, CURLINFO_HEADER_SIZE);
    $this->headers = curl_getinfo($this->handle, CURLINFO_HEADER_OUT );

    return $this;
}

Addendum 2

The error I get as a response is
Malformed XML message, JProxyPayLink element missing

The strange is that I make two requests. The first one for preAuth and it works just fine, but when I try to make the payment I get the above error. The code is exactly identical.

Update

Here is the second argument I'm trying to pass

    $command = <<<XMLCOMMAND
<?xml version="1.0" encoding="UTF-8"?>
<JProxyPayLink>
<Message>
<Type>Capture</Type>
<Authentication>
<MerchantID>{$this->getMerchant()}</MerchantID>
<Password>{$this->getPassword()}</Password>
</Authentication>
<OrderInfo>
<Amount>{$this->getAmount()}</Amount>
<MerchantRef>{$this->getMerchantRef()}</MerchantRef>
<MerchantDesc />
<Currency>{$this->getCurrency()}</Currency>
<CustomerEmail>{$this->getCustomerEmail()}</CustomerEmail>
<Var1 />
<Var2 />
<Var3 />
<Var4 />
<Var5 />
<Var6 />
<Var7 />
<Var8 />
<Var9 />
</OrderInfo>
<PaymentInfo>
<CCN>{$this->getCardNumber()}</CCN>
<Expdate>{$this->getExpirationDate()}</Expdate>
<CVCCVV>{$this->getCertificationNumber()}</CVCCVV>
<InstallmentOffset>0</InstallmentOffset>
<InstallmentPeriod>0</InstallmentPeriod>
</PaymentInfo>
</Message>
</JProxyPayLink>
XMLCOMMAND;

And the data.

    $command = str_replace(PHP_EOL, '', $command);

    $data = ['APACScommand' => 'NewPayment','data' => $command];

    curl_setopt($this->handle, CURLOPT_POSTFIELDS, http_build_query($data));

Somehow it works for another APACScommand command but not for this.

Addendum

The structure. I've already initialize curl_init.

public function post() {
    curl_setopt($this->handle, CURLOPT_URL,$this->url);
    curl_setopt($this->handle, CURLOPT_RETURNTRANSFER, true);



    curl_setopt($this->handle, CURLOPT_VERBOSE, 1);
    curl_setopt($this->handle, CURLOPT_HEADER, 1);

    //
    curl_setopt($this->handle, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
    curl_setopt($this->handle, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($this->handle, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($this->handle, CURLOPT_POST, true);

    //http_build_query
    curl_setopt($this->handle, CURLOPT_POSTFIELDS, http_build_query($this->data));

    $this->result = curl_exec( $this->handle );
    
    $this->headerSize = curl_getinfo($this->handle, CURLINFO_HEADER_SIZE);
    $this->headers = curl_getinfo($this->handle, CURLINFO_HEADER_OUT );

    return $this;
}

Addendum 2

The error I get as a response is
Malformed XML message, JProxyPayLink element missing

The strange is that I make two requests. The first one for preAuth and it works just fine, but when I try to make the payment I get the above error. The code is exactly identical.

added 10 characters in body
Source Link
Malformed XML message, JProxyPayLink element missing
XML message, JProxyPayLink element missing
Malformed XML message, JProxyPayLink element missing
added 1 characters in body
Source Link

Addendum 2

The error I get as a response is
XML message, JProxyPayLink element missing

The strange is that I make two requests. The first one for preAuth and it works just fine, but when I try to make the payment I get the above error. The code is exactly identical.

Addendum 2

The error I get as a response is
XML message, JProxyPayLink element missing

The strange is that I make two requests. The first one for preAuth and it works just fine, but when I try to make the payment I get the above error. The code is exactly identical.

added 1 characters in body
Source Link
Loading
added 870 characters in body
Source Link
Loading
added 1297 characters in body
Source Link
Loading
added 173 characters in body
Source Link
Loading
Source Link
Loading