Integration of ProAbono is achieved in 3 API calls.

1 – Add or Update a Customer

Make this call everytime a user sign-in into your application.
In the request, you provide a unique reference along with a few basic information on the user.
ProAbono will insert a new Customer or update an existing one if the reference already exists.

POST /v1/Customer
{

“ReferenceCustomer”: “123456”,
“Name”: “John Doe”,
“Email”: “john@doe.com”,
“Language”: “en”

}

2 – Display the ProAbono widget

Make this call in a dedicated ‘Subscription’ page of your application.
In the request, you provide the Customer unique reference.
The response will contains a unique URL to use as source of a secured iframe.
ProAbono will display all information for the customer to subscribe or manage its subscription.

iFrame Code:

<iframe src="{url-hosted-page}" width="100%" height="600" frameborder="0"></iframe>

Replace {url-hosted-page} by the Url “hosted-home” retrieved with

GET /v1/Customer?ReferenceCustomer=123456

Response
{
    "Id": 64079,
    "ReferenceCustomer": "123456",
    "ReferenceSegment": "sandbox-eur",  
    "Name": "John Doe",
    "Email": "john@doe.com",
    "Language": "en",
    "Links": [
        {   "rel": "hosted-collection-offers",
            "href": "https://sandbox-eur.proabono.com/offers/{Unique-Encrypted-URL}"
        },
        {   "rel": "hosted-home",
            "href": "https://sandbox-eur.proabono.com/offers/{Another-Unique-Encrypted-URL}"
        }       
    ]
}
Encrypted links: Links to the hosted pages (“rel” starting with “hosted”) are not permalinks, they may expire. Do not store them, use the API to get a fresh version every time you need them.

3 – Check quantity

Make this call when a user is accessing a resource available to customers only.
In the request, provide the Customer unique reference and the Feature unique reference.
The response will tell you if the user is allowed to access the resource and for what quantity.
This simple mechanism has many usages, check this page to know more.

GET /v1/Usage&ReferenceCustomer=123456&ReferenceFeature=users
Response
{
    "IdSegment": 3,
    "IdFeature": 48,
    "IdCustomer": 77873,
    "ReferenceSegment": "sandbox-eur",
    "ReferenceFeature": "users",
    "ReferenceCustomer": "123456",
    "TypeFeature": "Limitation",
    "QuantityIncluded": 4,
    "QuantityCurrent": 4,
    "DatePeriodStart": "2016-03-30T22:11:32.00Z",
    "DatePeriodEnd": "2016-04-13T21:50:45.00Z"
}

See Developer tutorial for quick integration