Payfast Payment Gateway returning errors

I’m struggling to get the Payfast payment gateway working. (Self hosted)

The merchant details required by the processor is
> Merchant ID
> Merchant Key
> Pdt Key

When client clicks on “pay now” it passes through to the payment gateway’s site. However it returns errors of missing of mismatching info being passed to the gateway.

In sandbox/test mode it returns:
> merchant_id : ID is not a valid merchant id
In live environment it returns the following error:
> signature : Generated signature does not match submitted signature

Is there anyway I can log or trace the variables being passed from invoiceninja to the payment gateway to be able to start the debugging process?

You can add dd($data); here:

https://github.com/invoiceninja/invoiceninja/blob/master/app/Ninja/PaymentDrivers/BasePaymentDriver.php#L302

Thanks Hillel, will try that.

To test whether the main fault lies with my hosting environment or with payment module of invoiceninja I created a free account on invoiceninja and it returns the same errors.

I tested to see which data is being pushed through according to your suggested method. It only displays the transaction details (see below, values modified for privacy purposes) yet I cannot see that it passing any of the relative merchant details (id, key & pdt). Is there a way to see if it passes that through to the gateway.

array:9 [▼
  "amount" => "20.00"
  "currency" => "ZAR"
  "returnUrl" => "https://www.test.com/public/complete/jgictwzcehfovvdyb3ndlzfzak9owsyv/credit_card"
  "cancelUrl" => "https://www.test.com/public/view/jgictwzcehfovvdyb3ndlzfzak9owsyv"
  "description" => "Invoice 0001"
  "transactionId" => "0001"
  "transactionType" => "Purchase"
  "ip" => "123.123.123.123"
  "card" => CreditCard {#897 ▼
    #parameters: ParameterBag {#908 ▼
      #parameters: array:21 [▼
        "email" => "mail@gmail.com"
        "billingCompany" => "CompanyName"
        "shippingCompany" => "CompanyName"
        "billingFirstName" => "MyName"
        "shippingFirstName" => "MyName"
        "billingLastName" => "Surname"
        "shippingLastName" => "Surname"
        "billingAddress1" => ""
        "billingAddress2" => ""
        "billingCity" => ""
        "billingPostcode" => ""
        "billingState" => ""
        "billingCountry" => ""
        "billingPhone" => ""
        "shippingAddress1" => ""
        "shippingAddress2" => ""
        "shippingCity" => ""
        "shippingPostcode" => ""
        "shippingState" => ""
        "shippingCountry" => ""
        "shippingPhone" => ""
      ]
    }
  }
]

I don’t know whether it’s helpful or not but the developer reference on the payfast site states that the pdt method (which the invoiceninja payment driver is using) is deprecated.
>>> https://www.payfast.co.za/documentation/pdt/

You’d need to debug the code, here’s the driver we use.

https://github.com/thephpleague/omnipay-payfast

I wish I could, my skill level is too rudimentary though, (haven’t coded php for over 10 years), and have no knowledge on the laravel framework.

Hope you guys can sort it out in future, like I said, the problem reproduces itself even when using the hosted solution on app.invoiceninja.com.

At the moment I’ll just use manual processing of payments as this is by far the best invoicing app I’ve tried out.