Search code examples
phppayment-gatewaycodeigniter-3

Trying to integrate Tap Payment gateway in codeigniter


I am trying to integrate Tap payment gateway in Codeigniter. I am using https://github.com/iZaL/tap-payment-php api. Because this does't give you any php support or any documentation.

So, I was busting my head from last 2 days to get this thing work, and so far I have done this.

This is the response i am successfully getting:

    BILLING
IZaL\Tap\TapBilling Object
(
    [ApiKey:protected] => 1tap7
    [MerchantID:protected] => mymercid
    [UserName:protected] => Tap@PS13
    [Password:protected] => *****
    [ErrorURL:protected] => 
    [PaymentURL:protected] => https://www.gotapnow.com/TapWebConnect/Tap/WebPay/PaymentRequest
    [PaymentOption:protected] => ALL
    [AutoReturn:protected] => Y
    [CurrencyCode:protected] => KWD
    [LangCode:protected] => AR
    [TotalAmount:protected] => 800
    [customerInfo:protected] => Array
        (
            [Email] => customer@email.com
            [Name] => Awesome Customer
            [Mobile] => 9999999
        )

    [productInfo:protected] => Array
        (
            [0] => Array
                (
                    [Quantity] => 1
                    [TotalPrice] => 500
                    [UnitName] => Product Name
                    [UnitDesc] => Product Description
                    [UnitPrice] => 500
                )

            [1] => Array
                (
                    [Quantity] => 2
                    [TotalPrice] => 300
                    [UnitName] => Product Name
                    [UnitDesc] => Product Description
                    [UnitPrice] => 150
                )

        )

    [gatewayInfo:protected] => Array
        (
            [Name] => ALL
        )

    [merchantInfo:protected] => Array
        (
            [ReturnURL] => http://sandbox/tap-payment-php-master/tests/TapBillingTest.php
            [ReferenceID] => 5addbc03781e0
        )

    [response] => IZaL\Tap\TapBillingResponse Object
        (
            [response] => GuzzleHttp\Psr7\Response Object
                (
                    [reasonPhrase:GuzzleHttp\Psr7\Response:private] => OK
                    [statusCode:GuzzleHttp\Psr7\Response:private] => 200
                    [headers:GuzzleHttp\Psr7\Response:private] => Array
                        (
                            [Cache-Control] => Array
                                (
                                    [0] => no-cache
                                )

                            [Pragma] => Array
                                (
                                    [0] => no-cache
                                )

                            [Content-Type] => Array
                                (
                                    [0] => application/json; charset=utf-8
                                )

                            [Expires] => Array
                                (
                                    [0] => -1
                                )

                            [Server] => Array
                                (
                                    [0] => Microsoft-IIS/8.0
                                )

                            [X-Powered-By] => Array
                                (
                                    [0] => UrlRewriter.NET 1.7.0
                                )

                            [X-AspNet-Version] => Array
                                (
                                    [0] => 4.0.30319
                                )

                            [Date] => Array
                                (
                                    [0] => Mon, 23 Apr 2018 11:01:38 GMT
                                )

                            [Content-Length] => Array
                                (
                                    [0] => 251
                                )

                        )

                    [headerNames:GuzzleHttp\Psr7\Response:private] => Array
                        (
                            [cache-control] => Cache-Control
                            [pragma] => Pragma
                            [content-type] => Content-Type
                            [expires] => Expires
                            [server] => Server
                            [x-powered-by] => X-Powered-By
                            [x-aspnet-version] => X-AspNet-Version
                            [date] => Date
                            [content-length] => Content-Length
                        )

                    [protocol:GuzzleHttp\Psr7\Response:private] => 1.1
                    [stream:GuzzleHttp\Psr7\Response:private] => GuzzleHttp\Psr7\Stream Object
                        (
                            [stream:GuzzleHttp\Psr7\Stream:private] => Resource id #43
                            [size:GuzzleHttp\Psr7\Stream:private] => 
                            [seekable:GuzzleHttp\Psr7\Stream:private] => 1
                            [readable:GuzzleHttp\Psr7\Stream:private] => 1
                            [writable:GuzzleHttp\Psr7\Stream:private] => 1
                            [uri:GuzzleHttp\Psr7\Stream:private] => php://temp
                            [customMetadata:GuzzleHttp\Psr7\Stream:private] => Array
                                (
                                )

                        )

                )

            [ApiKey:protected] => 
            [MerchantID:protected] => 
            [UserName:protected] => 
            [Password:protected] => 
            [ErrorURL:protected] => 
            [PaymentURL:protected] => https://www.gotapnow.com/TapWebConnect/Tap/WebPay/PaymentRequest
            [PaymentOption:protected] => ALL
            [AutoReturn:protected] => Y
            [CurrencyCode:protected] => KWD
            [LangCode:protected] => AR
            [TotalAmount:protected] => 800
            [customerInfo:protected] => Array
                (
                )

            [productInfo:protected] => Array
                (
                )

            [gatewayInfo:protected] => Array
                (
                )

            [merchantInfo:protected] => Array
                (
                )

            [requiredConstructorKeys:protected] => Array
                (
                )

        )

    [requiredConstructorKeys:protected] => Array
        (
        )

)
paymentRequest

IZaL\Tap\TapBilling Object
(
    [ApiKey:protected] => 1tap7
    [MerchantID:protected] => 70518
    [UserName:protected] => Tap@PS13
    [Password:protected] => PSt@13Tap
    [ErrorURL:protected] => 
    [PaymentURL:protected] => https://www.gotapnow.com/TapWebConnect/Tap/WebPay/PaymentRequest
    [PaymentOption:protected] => ALL
    [AutoReturn:protected] => Y
    [CurrencyCode:protected] => KWD
    [LangCode:protected] => AR
    [TotalAmount:protected] => 800
    [customerInfo:protected] => Array
        (
            [Email] => customer@email.com
            [Name] => Awesome Customer
            [Mobile] => 9999999
        )

    [productInfo:protected] => Array
        (
            [0] => Array
                (
                    [Quantity] => 1
                    [TotalPrice] => 500
                    [UnitName] => Product Name
                    [UnitDesc] => Product Description
                    [UnitPrice] => 500
                )

            [1] => Array
                (
                    [Quantity] => 2
                    [TotalPrice] => 300
                    [UnitName] => Product Name
                    [UnitDesc] => Product Description
                    [UnitPrice] => 150
                )

        )

    [gatewayInfo:protected] => Array
        (
            [Name] => ALL
        )

    [merchantInfo:protected] => Array
        (
            [ReturnURL] => http://sandbox/tap-payment-php-master/tests/TapBillingTest.php
            [ReferenceID] => 5addbc03781e0
        )

    [response] => IZaL\Tap\TapBillingResponse Object
        (
            [response] => GuzzleHttp\Psr7\Response Object
                (
                    [reasonPhrase:GuzzleHttp\Psr7\Response:private] => OK
                    [statusCode:GuzzleHttp\Psr7\Response:private] => 200
                    [headers:GuzzleHttp\Psr7\Response:private] => Array
                        (
                            [Cache-Control] => Array
                                (
                                    [0] => no-cache
                                )

                            [Pragma] => Array
                                (
                                    [0] => no-cache
                                )

                            [Content-Type] => Array
                                (
                                    [0] => application/json; charset=utf-8
                                )

                            [Expires] => Array
                                (
                                    [0] => -1
                                )

                            [Server] => Array
                                (
                                    [0] => Microsoft-IIS/8.0
                                )

                            [X-Powered-By] => Array
                                (
                                    [0] => UrlRewriter.NET 1.7.0
                                )

                            [X-AspNet-Version] => Array
                                (
                                    [0] => 4.0.30319
                                )

                            [Date] => Array
                                (
                                    [0] => Mon, 23 Apr 2018 11:01:38 GMT
                                )

                            [Content-Length] => Array
                                (
                                    [0] => 251
                                )

                        )

                    [headerNames:GuzzleHttp\Psr7\Response:private] => Array
                        (
                            [cache-control] => Cache-Control
                            [pragma] => Pragma
                            [content-type] => Content-Type
                            [expires] => Expires
                            [server] => Server
                            [x-powered-by] => X-Powered-By
                            [x-aspnet-version] => X-AspNet-Version
                            [date] => Date
                            [content-length] => Content-Length
                        )

                    [protocol:GuzzleHttp\Psr7\Response:private] => 1.1
                    [stream:GuzzleHttp\Psr7\Response:private] => GuzzleHttp\Psr7\Stream Object
                        (
                            [stream:GuzzleHttp\Psr7\Stream:private] => Resource id #43
                            [size:GuzzleHttp\Psr7\Stream:private] => 
                            [seekable:GuzzleHttp\Psr7\Stream:private] => 1
                            [readable:GuzzleHttp\Psr7\Stream:private] => 1
                            [writable:GuzzleHttp\Psr7\Stream:private] => 1
                            [uri:GuzzleHttp\Psr7\Stream:private] => php://temp
                            [customMetadata:GuzzleHttp\Psr7\Stream:private] => Array
                                (
                                )

                        )

                )

            [ApiKey:protected] => 
            [MerchantID:protected] => 
            [UserName:protected] => 
            [Password:protected] => 
            [ErrorURL:protected] => 
            [PaymentURL:protected] => https://www.gotapnow.com/TapWebConnect/Tap/WebPay/PaymentRequest
            [PaymentOption:protected] => ALL
            [AutoReturn:protected] => Y
            [CurrencyCode:protected] => KWD
            [LangCode:protected] => AR
            [TotalAmount:protected] => 800
            [customerInfo:protected] => Array
                (
                )

            [productInfo:protected] => Array
                (
                )

            [gatewayInfo:protected] => Array
                (
                )

            [merchantInfo:protected] => Array
                (
                )

            [requiredConstructorKeys:protected] => Array
                (
                )

        )

    [requiredConstructorKeys:protected] => Array
        (
        )

)
payment Response

stdClass Object
(
    [ReferenceID] => 204232018320144980
    [ResponseCode] => 0
    [ResponseMessage] => Success
    [TapPayURL] => https://www.gotapnow.com/webpay.aspx
    [PaymentURL] => https://www.gotapnow.com/webpay.aspx?ref=204232018320144980&sess=ir2%2bGzVBwwM51cvkOTtnR69nS%2bVU24bu
)
paymentURL

https://www.gotapnow.com/webpay.aspx?ref=204232018320144980&sess=ir2%2bGzVBwwM51cvkOTtnR69nS%2bVU24bu
paymentReferenceID

204232018320144980
null 

As you can see in the end, I am getting success response, but when I am hitting this url it gives to me:

An error was encountered while processing your payment!

I tried everything on my side and other, so if anyone can help my it would be really great.

Thanks!


Solution

  • luckily I succeeded. As There is not much documentation available out there but Here is a documentation and library which I used to make it happened. Hope It will help other too.