What's the difference between the callback URL and the return URL

 


Return URL: 

Must be https, otherwise no data is returned.

The return URL is a browser redirection request.

Returned values will be in form data formats (key=value)

Optional variable


Callback URL: 

Must be https, otherwise no data is returned. Also must be Public reachable URL, Port numbers are not allowed.

The callback URL is a server to the server request, The customer's browser is not involved.

Optional variable



Example: URL: https://secure.paytabs.com/payment/request


Disclaimer:  There is no success/ failure URL. There's is only a return URL.  A transaction approved if respStatus equals "A".

Example:


Form values

acquirerMessage

100:ACCEPT

acquirerRRN

025718177175

cartId

Sample Payment

customerEmail

[email protected]

respCode

831000

respMessage

Authorised

respStatus

A

token

2C4650BC67A3EB30C6B791FA63827EB8bcbcb

tranRef

TST202570000063666

signature

evvvvf75220656b03921b5acb45efce7d3058d9d7cddd480323c74df9249fa882838



In the event a developer is trying to test the integration over local host or HTTP only staging server, the following solutions are recommended:


  • Try this website:
    https://webhook.site/
    Which gives you an https, unique URL to use in your test
  • ngrok tool, which convert your local machine into public server
  • You could also build a small adapter into your production server which receives the response over https then post it back over http to your staging server


However, the recommended option is to change your staging website to https.


Good to know also there are 4 ways where you receive the response from Paytabs:
 
  1. Return: redirects the customer after completing the payment, basic "payment details" are posted within this request
    (note: acquirerRPN, respCode ... will be different on Live profiles because they are sent from the bank side)

    acquirerMessage=
    &acquirerRRN=
    &cartId=cart_11111
    &customerEmail=wajih%40domain.com
    &respCode=G77803
    &respMessage=Authorised
    &respStatus=A
    &token=
    &tranRef=TST2028600008198
    &signature=7311d9171c251c9a6297a281b9fbbc7c2325fcc9f7cb9255e6de3b535d9b7625
  2. Callback: paytabs server posts payment details to this URL after completing the payment (more detailed "payment info" posted)
    {
      "tran_ref": "TST2028600008198",
      "cart_id": "cart_11111",
      "cart_description": "Description of the items",
      "cart_currency": "AED",
      "cart_amount": "12.3",
      "customer_details": {
        "name": "wajih last",
        "email": "[email protected]",
        "phone": "0522222222",
        "street1": "address street",
        "city": "dubai",
        "state": "DU",
        "country": "AE",
        "ip": "92.98.175.138"
      },
      "shipping_details": {
        "name": "wajih last1",
        "email": "[email protected]",
        "phone": "971555555555",
        "street1": "street2",
        "city": "dubai",
        "state": "DU",
        "country": "AE",
        "ip": "92.98.175.138"
      },
      "payment_result": {
        "response_status": "A",
        "response_code": "G77803",
        "response_message": "Authorised",
        "transaction_time": "2020-10-12T04:43:23Z"
      },
      "payment_info": {
        "card_type": "Credit",
        "card_scheme": "Visa",
        "payment_description": "4111 11## #### 1111"
      }
    }
  3. IPN: https://merchant.paytabs.com/merchant/developers/guides/ipn
    Merchant controls what notification type to receive from paytabs, paytabs server will post data to IPN listener whenever an event occurs on merchant's account (based on the IPN configuration)

    {
      "tran_ref": "TST2028700008414",
      "merchant_id": 1xxx,
      "profile_id": 47xxx,
      "cart_id": "cart_11111",
      "cart_description": "Description of the items",
      "cart_currency": "AED",
      "cart_total": "12.3",
      "tran_type": "Sale",
      "tran_class": "ECom",
      "customer_name": "wajih last",
      "customer_email": "[email protected]",
      "customer_country": "AE",
      "customer_ip": "86.96.8.45",
      "response_status": "A",
      "response_code": "G70961",
      "response_message": "Authorised",
      "acquirer_message": "",
      "acquirer_rrn": "",
      "card_type": "Credit",
      "payment_description": "4111 11## #### 1111"
    }
  4. Query transaction: https://merchant.paytabs.com/merchant/developers/guides/transaction
    Query the transaction result whenever you want, usually after the payment completes and return URL has been called
    response will be same to callback response