NAV
curl javascript php ruby

Info

Welcome to the generated API reference. Get Postman Collection

API

API Endpoints

Production - https://liveapi.payright.com.au/v2/

Sandbox - https://api.payright.com.au/v2/

Payright Direct Workflow

alt text

  1. Merchant calls the /v1/configuration/ endpoint to refresh Payright configuration.
  2. Merchant determines if the checkout should display Payright as a payment option.
  3. Merchant calls the /v1/orders/ endpoint to initiate the Payright payment process.
  4. The order token to return and stored by the merchant.
  5. Merchant executes the Payright.redirect({token: YOUR_TOKEN}); JavaScript function within the page to redirect to the Payright login page.
  6. The consumer’s order is preapproved for a subsequent payment request.
  7. On the successful completion of the Payright pre-approval process,
  8. Payright will redirect back to the provided redirectConfirmUrl appending the token and a status of ‘SUCCESS’, 'CANCELLED’, 'FAILURE’ as a HTTP query parameter.
  9. If the merchant is able to fulfil the order, the merchant calls the /v1/payments endpoint to capture the payment.
  10. Payright finalises the consumers' payment and responds with a success or failure.
  11. If the Payright payment was successful the merchant displays an Order success page.
  12. Should the Pay right payment request fail, this may occur if the consumers' card is declined, the merchant displays an Order failure page including failure details.

    Rest

    The Payright Online API is organized around REST. The API attempts to use predictable, resource-oriented URLs and to use HTTP response codes to indicate errors.

    HTTPS

    The Payright online API requires all interactions to be secured using TLS 1.2 or greater.

    Request Headers

    Clients must send appropriate headers with all requests

Field Name Requirement Description
Authorization required
Content-Type required All POST and PUT requests must declare the content-type as application/json
Accept required All requests must accept application/json

Timeouts

Payright will attempt to respond to requests as soon as possible, but often latency delays are outside of our control. Where an API call is dependant on downstream banking networks the response times can be higher. As a guideline, this document provides recommended network connection open timeout and read timeout values for each API resource. Resources that are dependant on banking networks will have higher timeout values. All resources that are identified as idempotent can be safely retried before the recommended timeout periods

Authentication

The Payright API uses Basic Authentication.

Consider the following example.

Username Password Grant Type Client ID Client Secret
demoapi@payright.com.au hollywood password 25 UgwmEHxq8lUvlN6MeurfjmSo7JifspYl1yMHs6xE

Final Header

Authorization: Token 2JgmBiRb1Ke3M8gY5OmPLWv1V13XwKAXy89dKmpt

Payright API Authorization

Return the access token and refresh token that needs to be used across to access all methods.

Example request:

curl -X POST "https://api.payright.com.au/api/v2/payrightApiauthorization" \
    -H "Accept: application/json" \
    -d "client_id"="25" \
        -d "client_secret"="UgwmEHxq8lUvlN6MeurfjmSo7JifspYl1yMHs6xE" \
        -d "username"="demoapi@payright.com.au" \
        -d "password"="hollywood" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.payright.com.au/api/v2/payrightApiauthorization",
    "method": "POST",
    "data": {
        "client_id": 25,
        "client_secret": "UgwmEHxq8lUvlN6MeurfjmSo7JifspYl1yMHs6xE",
        "username": "demoapi@payright.com.au",
        "password": "hollywood"
    },
    "headers": {
        "accept": "application/json"
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});

Example response:

{
    "token_type": "Bearer",
    "expires_in": 31622400,
    "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjQzNzRiY2Q3MTIwNDk5NTUyNzAzYmI0ZjA4ODFkN2E3MDNiNTZmZTcyZDI3ODIxYWY4MjRlMGQwY2ZiNWU0ZWI5YjBiZTQxMWI3ZGQ2NGEzIn0.eyJhdWQiOiIzIiwianRpIjoiNDM3NGJjZDcxMjA0OTk1NTI3MDNiYjRmMDg4MWQ3YTcwM2I1NmZlNzJkMjc4MjFhZjgyNGUwZDBjZmI1ZTRlYjliMGJlNDExYjdkZDY0YTMiLCJpYXQiOjE1NTY1MDk5NTksIm5iZiI6MTU1NjUwOTk1OSwiZXhwIjoxNTg4MTMyMzU5LCJzdWIiOiIxIiwic2NvcGVzIjpbXX0.r7X1y9CbGT11dndcmgk6zP2CumQ7COiWGhp7pNq6siIxMX-vcdx-DvMbkmEsw3oLiw1zFoWiCA4etiFcYMjsa6VKg9NHn_zvQRuHIbHkUAlPbvtiAC6VLT25kniGfqlPPcK6Nygs7LiUxKwPg6Phij9ivzpLPzAWebMG226dLwztWB2t0N7VxnoBfNusqK2Op5jJNPKjTcQHuWKv7kEBe6Zu2oitfKSu6yOoBr27jK14dEk6fwS24gh97n0xUb1MffuRrTtRIB4I6Idmh1Pbm799USdffXcMTyUcRf2hu2C4oZRzLJwArfFTRI4e4w94tOg36JTaQhcytFtjfT8XfOtoVRJL4mGbkVyFsu7hg6DbS7yYrQp96EAOmr1Yp9kXZH2ZPFiquq7ObTff18Nhd5I7jO16aF36hn9VgmgNuQT36hehwVE-n1SuXoZ9fF6HJU6smQ25Lqs856AlbYpqhmKzXpvRE-1O2W1lZmg8WO86UgLkVUtUw4BwkwM1Hw64EPeH5TS83xFRa51n17lyQV6Tzl_lb3npKJuJa-dIKsdB8KrCEPSYVerqqgZsEc8wqHxyEyCKZfZWlEqamdhqbwlggSZoclxOkk5xYPkgnecOCIbWmtCu-wamV8O4b9ocDlnpEnFWW7D_aeSQTMWEzpEjX0nwBbU93bEBOFxNHE0",
    "refresh_token": "def50200fe8302e4c6ce016856dce04607ec7413206dd481eb59803328f3ce90ce2149f083ad6fa58ece0c7c009d2871bef334612d6959d30798348c535e11aabe7dbc7b57da6643c4705c4614fe972950238d1da29451e887395c65b667d910e7d37b58c9ba7aa4bfc36dc0418d9244760eb6832c9e2cf5ee4775c53f14348d47470c248f5a0a3b4db4ae6adff1c7b846d4d551c00e46a281703c68b9290b6c05f1572afd6360521fd263643e7732b2812bb8c3750cafd7ee48cac1049d15796ea2f44fd290ab5617f71dea2443833951b3881f871801dc8c102635738f758bd4c9c1a81312c09ee8c3fa207e06bc83e8720c1d8607c39a93e7dc79eaa04dfed8e912ef091dbaab922e4714f10c4b94252f31cf91886c7142b9318e5debcac76e760c23eb0a7abfd82113d1977eded8fe5bdb5527917e04e2d99e7af4d8e1936e5e6a8b3a0f112fb57a00996e6400cef41754a7098d84c3d5bfc56391354f0b78"
}

HTTP Request

POST api/v2/payrightApiauthorization

Parameters

Parameter Type Status Description
client_id integer required
client_secret string required
username string optional
password string optional

Configuration

Ecommerce Configuration

Request the merchant configuration via the API, this would return merchant store configuration necessary for the e-commerce environment.

If success 200 & token

If FAILED Unauthorised 401

Example request:

curl -X POST "https://api.payright.com.au/api/v2/getConfiguration" \
    -H "Accept: application/json" \
    -d "merchantusername"="demoapi" \
        -d "merchantpassword"="hollywood" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.payright.com.au/api/v2/getConfiguration",
    "method": "POST",
    "data": {
        "merchantusername": "demoapi",
        "merchantpassword": "hollywood"
    },
    "headers": {
        "accept": "application/json"
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});

Example response:

{
    "success": true,
    "data": {
        "prToken": "34acea01879ad3ff5c813b5083648daa",
        "configToken": "7UQy1rT7eg51AQ1VVaXZDbfYfxU1R94E"
    }
}

HTTP Request

POST api/v2/getConfiguration

Parameters

Parameter Type Status Description
merchantusername string required
merchantpassword string required

Plan

Activate Plan

Once the product is shipped out, the plan can be activated the user and recurring payments commence. Returns the plan status, config token and date when the plan was activated.

Example request:

curl -X POST "https://api.payright.com.au/api/v2/getPlanActivated" \
    -H "Accept: application/json" \
    -d "prToken"="0305a33424f4c887cbccf66a9241cddc" \
        -d "configToken"="ocq5jXGrsi7UNc65nezBc3S3l2Svh6Nf" \
        -d "planNumber"="C006146_219" \
        -d "merchantReference"="Quote - 448" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.payright.com.au/api/v2/getPlanActivated",
    "method": "POST",
    "data": {
        "prToken": "0305a33424f4c887cbccf66a9241cddc",
        "configToken": "ocq5jXGrsi7UNc65nezBc3S3l2Svh6Nf",
        "planNumber": "C006146_219",
        "merchantReference": "Quote - 448"
    },
    "headers": {
        "accept": "application/json"
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});

Example response:

{
    "success": true,
    "data": {
        "configToken": "ocq5jXGrsi7UNc65nezBc3S3l2Svh6Nf",
        "DateTime": {
            "date": "2019-07-09 16:22:44.664420",
            "timezone_type": 3,
            "timezone": "Australia/Sydney"
        },
        "status": "This plan cannot be activated until the deposit has been paid."
    }
}

HTTP Request

POST api/v2/getPlanActivated

Parameters

Parameter Type Status Description
prToken string required
configToken string required
planNumber string required
merchantReference string required

Refund

Ecommerce Request Refund

Generates the e-commerce token that is used in the redirection as a GET parameter Returns the refund reference, date, request status and the plan number.

Example request:

curl -X POST "https://api.payright.com.au/api/v2/getRequestRefund" \
    -H "Accept: application/json" \
    -d "prToken"="0305a33424f4c887cbccf66a9241cddc" \
        -d "configToken"="ocq5jXGrsi7UNc65nezBc3S3l2Svh6Nf" \
        -d "planNumber"="C006146_219" \
        -d "refundAuthPersonal"="test" \
        -d "refundAmount"="1000" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.payright.com.au/api/v2/getRequestRefund",
    "method": "POST",
    "data": {
        "prToken": "0305a33424f4c887cbccf66a9241cddc",
        "configToken": "ocq5jXGrsi7UNc65nezBc3S3l2Svh6Nf",
        "planNumber": "C006146_219",
        "refundAuthPersonal": "test",
        "refundAmount": "1000"
    },
    "headers": {
        "accept": "application/json"
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});

Example response:

{
    "refundReference": "1zagr68u4r",
    "requestDateTime": {
        "date": "2019-07-09 06:16:26.000000",
        "timezone_type": 3,
        "timezone": "UTC"
    },
    "requestStatus": "In Progress",
    "planName": "C006146_219"
}

HTTP Request

POST api/v2/getRequestRefund

Parameters

Parameter Type Status Description
prToken string required
configToken string required
planNumber string required
refundAuthPersonal string required
refundAmount string required

Transactions

Ecommerce Initialize Transaction

Initialise the transaction and generate the ecom token that is used for the redirection. Returns the ecomToken, config token, created date and updated date.

Example request:

curl -X POST "https://api.payright.com.au/api/v2/getintializeTransaction" \
    -H "Accept: application/json" \
    -d "prToken"="ef4d2ce38aad5b04d692f1ba9a03cae7" \
        -d "ConfigToken"="aPVtTjqGXuIRD1JC8tvewclht5vjEQGC" \
        -d "transactiondata"='{"saleAmount":"100","platform_type":"magento"}' \
        -d "merchantReference"="API_testMerchant18" \
        -d "clientId"="25" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.payright.com.au/api/v2/getintializeTransaction",
    "method": "POST",
    "data": {
        "prToken": "ef4d2ce38aad5b04d692f1ba9a03cae7",
        "ConfigToken": "aPVtTjqGXuIRD1JC8tvewclht5vjEQGC",
        "transactiondata": '{"saleAmount":"100","platform_type":"magento"}',
        "merchantReference": "API_testMerchant18",
        "clientId": 25
    },
    "headers": {
        "accept": "application/json"
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});

Example response:

{
   "success": true,
    "data": {
        "ecommToken": "gazubyuwqkgysq2yk6fi64cxclhrvw8j",
        "configToken": "aPVtTjqGXuIRD1JC8tvewclht5vjEQGC",
        "createdDate": {
            "date": "2019-07-09 06:20:32.000000",
            "timezone_type": 3,
            "timezone": "UTC"
        },
        "updatedDate": {
            "date": "2019-07-09 06:20:32.000000",
            "timezone_type": 3,
            "timezone": "UTC"
        },
        "user_id": "25",
        "transactionreference": "97invdcdrl",
        "merchantReference": "API_testMerchant18"
    }
}

HTTP Request

POST api/v2/getintializeTransaction

Parameters

Parameter Type Status Description
prToken string required
ConfigToken string required
transactiondata string required
merchantReference string required
clientId integer required

Transaction Overview

Request for the transaction overview, in order to generate the repayment overview data with Payright. Give access to the repayment terms that need to be displayed to the customer

Example request:

curl -X POST "https://api.payright.com.au/api/v2/transactionOverview" \
    -H "Accept: application/json" \
    -d "Token"="0305a33424f4c887cbccf66a9241cddc" \
        -d "ConfigToken"="ocq5jXGrsi7UNc65nezBc3S3l2Svh6Nf" \
        -d "saleamount"="600" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.payright.com.au/api/v2/transactionOverview",
    "method": "POST",
    "data": {
        "Token": "0305a33424f4c887cbccf66a9241cddc",
        "ConfigToken": "ocq5jXGrsi7UNc65nezBc3S3l2Svh6Nf",
        "saleamount": 600
    },
    "headers": {
        "accept": "application/json"
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});

Example response:

{
     "success": true,
    "data": {
        "LoanAmount": "600.00",
        "EstablishmentFee": 79.9,
        "minDeposit": "0.00",
        "TotalCreditRequired": "679.90",
        "Accountkeepfees": "3.5",
        "processingfees": "2.95",
        "saleAmount": "600.00",
        "noofrepayments": 78,
        "repaymentfrequency": "Fortnightly",
        "LoanAmountPerPayment": "13.28"
    }
}

HTTP Request

POST api/v2/transactionOverview

Parameters

Parameter Type Status Description
Token string required
ConfigToken string required
saleamount numeric required

Ecommerce Query Transaction

getQueryTransaction get the details from transactions.

This method is used to check for the status of the transaction.

Example request:

curl -X POST "https://api.payright.com.au/api/v2/getQueryTransaction" \
    -H "Accept: application/json" \
    -d "prToken"="d751104c87140a71970ba89c291917fa" \
        -d "configToken"="LvW52ticwRj8ymeeESgVEk95UPZTVk84" \
        -d "planNumber"="C006146_219" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.payright.com.au/api/v2/getQueryTransaction",
    "method": "POST",
    "data": {
        "prToken": "0305a33424f4c887cbccf66a9241cddc",
        "configToken": "ocq5jXGrsi7UNc65nezBc3S3l2Svh6Nf",
        "planNumber": "C006146_219"
    },
    "headers": {
        "accept": "application/json"
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});

Example response:

{
     "success": true,
    "data": {
        "planStatus": "Approved",
        "configToken": "ocq5jXGrsi7UNc65nezBc3S3l2Svh6Nf",
        "planId": "d26b4b72-9d2b-11e9-bb1d-0209a59d6002",
        "payRightRef": "iglp3usitlm8af6cqlu2vnoajmmca4i1",
        "created": "2019-07-03T10:45:15+10:00",
        "customerName": "Miss testfirstname testlastname",
        "salesPerson": "Ms. Parami liyanage",
        "depositStatus": "",
        "creditAmount": "869.950000",
        "settled": "",
        "settledDate": "",
        "MSF": "Quote - 448",
        "Term": "03",
        "DateTime": ""
    }
}

HTTP Request

POST api/v2/getQueryTransaction

Parameters

Parameter Type Status Description
prToken string required
configToken string required
planNumber string required