Internal server Error on invoice creation

pablo.pizarro's Avatar

pablo.pizarro

13 Jul, 2018 03:31 PM

Hello GoCoin support

I'm a developer implementing your API for an OTA. After making some succesful tests with the Postman App, I've started to implement on our system, but I've hit a roadblock.

I'm having trouble creating invoices, since whenever I send the callback_url or the redirect_url suplied by my frontend colleagues, the API is giving me a 500 error. I'm suspecting these params have a size limit, even though I have found no mention of this constraint in the docs. Is thatthe case?

This is the payload I send when creating an invoice. i got no trouble creating it without redirect_url or callback_url, or sending the example.com urls:

{
   "order_id":"4194835TT401",
   "base_price":"24.30",
   "base_price_currency":"EUR",
   "price_currency":"BCH",
   "item_name":"Hotel",
   "item_description":"Hotel. Nuevo Boston - Madrid",
   "callback_url":"https://res.muchoviaje.com/scr/payment/external/notification?brand=yveb87&t=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJkYXRhIjp7InN0aWQiOiIyMGVkNDZhNC0zOTI5LTRmMTEtOWVkOC1kODgwMGI3MzcyYWMiLCJzaWQiOiI3MDc1MDZjOC1kODJjLTQ0NjMtYjM2Yi1jMDM3NzFhZGNmOTIiLCJ1aWQiOiIxODEzZjAzY2IzMjllZGMxOWMzZjI2M2QzM2RkY2M5OGI1ZmY4Y2RhIn19.usXxTqMIOhbsnuGrwBwrweXBEWhojufII4YGjMOWN94&sid=2ad3669666d411dff269674a6fba89f9&purchase_id=4194835",
   "redirect_url":"https://res.muchoviaje.com/scr/payment/external/redirect_response?brand=yveb87&t=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJkYXRhIjp7InN0aWQiOiIyMGVkNDZhNC0zOTI5LTRmMTEtOWVkOC1kODgwMGI3MzcyYWMiLCJzaWQiOiI3MDc1MDZjOC1kODJjLTQ0NjMtYjM2Yi1jMDM3NzFhZGNmOTIiLCJ1aWQiOiIxODEzZjAzY2IzMjllZGMxOWMzZjI2M2QzM2RkY2M5OGI1ZmY4Y2RhIn19.usXxTqMIOhbsnuGrwBwrweXBEWhojufII4YGjMOWN94"
}

Thank you for your time.

  1. Support Staff 1 Posted by GoCoin DevTeam on 13 Jul, 2018 04:24 PM

    GoCoin DevTeam's Avatar

    Hello

    I tested the exact JSON snippet you provided and it worked in my dev environment. We will look through the logs and see if anything shows up there.

  2. Support Staff 2 Posted by GoCoin DevTeam on 13 Jul, 2018 05:02 PM

    GoCoin DevTeam's Avatar

    Hi Pablo

    I have confirmed that the issue is URL string length as you suspected. (Loading db schema in our dev environment does not exactly replicate our staging & production databases due to version changes over time.) Currently our production database will not accept redirect_url or callback_url greater than 255 characters. We will look into increasing that limit, but it probably will not happen until early next week.

  3. 3 Posted by pablo.pizarro on 16 Jul, 2018 01:44 PM

    pablo.pizarro's Avatar

    Thanks for the fast response, we are looking forward to that change.

    I'm not sure if this is the right place to do so, but I've encountered a
    couple more annoyances while implementing.

    First, I haven't found a setting on the control panel to change the
    payout currency to EUR. When creating the invoice, are the received
    exchange rates (spot, inverse_spot) dependent on the payout currency or
    we need to use the spot_rate and the usd_spot_rate to get to our desired
    "eur_spot_rate" equivalent?

    Also, I'm getting a 422 http error when trying to change the split
    values on the payment settings tab.

    Thanks for your time.

    El 13/07/18 a las 19:02, GoCoin DevTeam escribió:

  4. Support Staff 4 Posted by GoCoin DevTeam on 16 Jul, 2018 02:36 PM

    GoCoin DevTeam's Avatar

    In order to use the payout split, you need a fiat payout account set up.

    We changed your payout currency to EUR.

  5. Support Staff 5 Posted by GoCoin DevTeam on 16 Jul, 2018 03:37 PM

    GoCoin DevTeam's Avatar

    The callback_url and redirect_url lengths have been increased. Please test again and let us know how things go.

  6. 6 Posted by pablo.pizarro on 16 Jul, 2018 03:50 PM

    pablo.pizarro's Avatar

    I've created the invoice no problem with the previously invalid urls, so
    thats a success, thanks!

    El 16/07/18 a las 17:37, GoCoin DevTeam escribió:

  7. 7 Posted by pablo.pizarro on 17 Jul, 2018 11:42 AM

    pablo.pizarro's Avatar

    Hello again, I'm back with another question since you are so fast and
    reliable :)

    I'm trying to test my callback_url implementation and I'm having trouble
    making the webhooks work.

    The steps I'm taking are: creating a bill, selecting the currency and
    getting the invoice ready to pay, then before it expires, from the
    invoice page on the dashboard, advanced options, select the
    invoice_payment_received and checking the callback_url is the one I sent
    in the bill creation. Then I click the "Send Webhook" button and watch
    my logs... where nothing happens.

    I've tested my callback_url on Chrome to rule out errors on my app entry
    point, and all works as intended, I just got no payload nor invoice
    obviously. I'm I missing something?

    This is the Chrome dev tools request data when I click the Send Webhook,
    if it helps:

         1.
            Request URL:
            https://dashboard.gocoin.com/api/invoices/a2f92ce9-9168-4c3c-adf2-3ea953dcf4d1/webhook
         2.
            Request Method:
            POST
         3.
            Status Code:
            204
         4.
            Remote Address:
            104.24.8.85:443
         5.
            Referrer Policy:
            no-referrer-when-downgrade
     1. Response Headers
         1.
            cf-ray:
            43bc6b490d932f95-MAD
         2.
            date:
            Tue, 17 Jul 2018 11:37:53 GMT
         3.
            etag:
            W/"a-oQDOV50e1MN2H/N8GYi+8w"
         4.
            expect-ct:
            max-age=604800,
            report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
         5.
            server:
            cloudflare
         6.
            status:
            204
         7.
            via:
            1.1 vegur
         8.
            x-powered-by:
            Express
         9.
            x-request-id:
            0dcfd6ba50644ae9a693868115af5e70
     2. Request Headers
         1.
            :authority:
            dashboard.gocoin.com
         2.
            :method:
            POST
         3.
            :path:
            /api/invoices/a2f92ce9-9168-4c3c-adf2-3ea953dcf4d1/webhook
         4.
            :scheme:
            https
         5.
            accept:
            application/json, text/plain, */*
         6.
            accept-encoding:
            gzip, deflate, br
         7.
            accept-language:
            es-ES,es;q=0.9
         8.
            content-length:
            449
         9.
            content-type:
            application/json;charset=UTF-8
        10.
            cookie:
            __cfduid=d1f276c8dab784bcf46c2a822cb4d4d3b1531145573;
            _ga=GA1.2.1969361701.1531145575; __utmc=167445672;
            _gid=GA1.2.2132566582.1531728790;
            __utmz=167445672.1531820722.13.6.utmcsr=doc.hotelkey.com|utmccn=(referral)|utmcmd=referral|utmcct=/doc/flyspray/;
            __utma=167445672.1969361701.1531145575.1531820722.1531823021.14;
            XDEBUG_SESSION=PHPSTORM; __utmb=167445672.9.10.1531823021;
            connect.sid=s%3Au-nHydiaKQc48c0M4llTw1qg6PHwoqBL.nq1%2FvCUECWx8tRoyFFJXGWHjRhkypbl9RaQv99NlYOM
        11.
            origin:
            https://dashboard.gocoin.com
        12.
            referer:
            https://dashboard.gocoin.com/invoices/a2f92ce9-9168-4c3c-adf2-3ea953dcf4d1
        13.
            user-agent:
            Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like
            Gecko) Chrome/67.0.3396.99 Safari/537.36
     3. Request Payloadview source
         1.
             1. {,…}
                 1. callback_url:"https://res.destinia.com/scr/payment/external/notification?t=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJkYXRhIjp7InN0aWQiOiI5NWI4YmUxNi1kNDQ2LTRjMWQtOGUyMy0yMWI0ZjhiM2UyZTgiLCJzaWQiOiJjZmYxZjNmYS1jN2VlLTRmMGMtYTE1Ny1mZTgxY2RmNmE1YTAiLCJ1aWQiOiJiMWIzYzhiYzNhNWNhNmJjMjJlNjMzNTc3ZTI0OGMyMTBlZGVhNmI3In19.ER43_2rnsYqQaykex61JwPaL9BMePiA2WeaQbeoKFXg&sid=681cf467411b21de85c209d48d694ffe&purchase_id=4235254"
                 2. event_type:"invoice_created"

    Thank you for your time!

    El 16/07/18 a las 17:37, GoCoin DevTeam escribió:

  8. Support Staff 8 Posted by GoCoin DevTeam on 17 Jul, 2018 03:11 PM

    GoCoin DevTeam's Avatar

    Do you have a firewall setup blocking incoming webhooks?

    Our webhooks come from the following IP addresses:
    34.197.13.90
    34.225.36.248

Discussions are closed to public comments.
If you need help with GoCoin Helpdesk please start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac