What should I log if I need support from PayJunction?

One of the primary benefits of integrating PayJunction as the payment solution for your product is the level of developer support PayJunction offers. In order for us to provide the best support possible when tracking down issues, please log at least the following information headers from HTTP responses returned by the PayJunction API in your debugging logs:

Timestamps

To help avoid confusion, timestamps in logs should be in the UTC timezone, with the TZ information included. RFC 3339 or ISO 8601 are the recommended formats:

    YYYY-MM-DD{T| }HH:MM:SS[.SECFRAC]{Z|+HH:MM}

The following examples are equivalent:

    2018-04-12T16:02:29Z
    2018-04-12 16:02:29+00:00

Most platforms provide built in functions to provide timestamps in RFC 3339 or ISO 8601 format:

JavaScript:

let timestamp = (new Date()).toISOString()

PHP:

$timestamp = date(DATE_RFC3339);

Python:

from datetime import datetime, timezone
timestamp = datetime.now(tz=timezone.utc).isoformat()

Consult the documentation for your platform and version for specifics on formatting for RFC 3339 or ISO 8601.

See RFC 3339 Date and Time on the Internet: Timestamps for more information

HTTP Headers

CF-RAY: This is the request identifier returned by Cloudflare, which PayJunction uses as an edge security provider for our cloud infrastructure. In the event that a request does not reach our servers, logging this information will allow us to dig deeper into what happened.

X-Pj-Request-Id: This header is returned by the PayJunction servers, and allows us to track down specific HTTP requests in our logs.

The requestPaymentId parameter returned as part of a Smart Terminal payment request is not the same as the id returned in the X-Pj-Request-Id header. The X-Pj-Request-Id header is the best reference to provide to PayJunction when support is needed.

Upgrading software packages can occasionally result in changes to the casing of headers as sent by the PayJunction servers or as read by the HTTP client library. It is always recommended to standardize the header names and test before direct reference.

Example:

response = requests.get('https://api.payjunctionlabs.com/customers/', ...)
cf_ray = None
request_id = None
for keyname in response.headers:
    if ‘cf-ray’ in keyname.lower():
        cf_ray = response.headers[keyname]
        continue
    if ‘pj-request-id’ in keyname.lower():
        request_id = response.headers[keyname]
        continue