Generate Payment Request Links


Introduction

The Cohort Go platform enables you to generate payments short-links that you can provide to students to request payment. Upon opening one of these links, the student will be delivered to a pre-built shopping cart and will be able proceed directly with choosing their payment method.

This URL can either be presented directly to a customer or alternatively rendered as a QR code for scanning from a mobile device.

Initial Configuration

Your Cohort Go account will need to be configured with our provider payments product. Your customer success manager will provide you with an API hostname and username/password credentials to access the API.

Creating an Invoice

To create an invoice, you will require a PDF of the invoice that is to be paid. This invoice can either be available online via a URL, or locally available to encode as base64.

To upload from a local invoice, assuming that the invoice is on the local file system as invoice.pdf, the following curl command can be used:

DOC=$(base64 -i blank.pdf)
INVOICE="{\"invoice\":{\"student\":{\"email\":\"[email protected]\",\"given_name\":\"Stu\",\"family_name\":\"Dent\",\"dob\":\"1990-05-18\",\"passport_number\":\"M1231234\",\"home_country\":\"VN\"},\"student_number\":\"12341234\",\"reference\":\"ABC1234\",\"amount\":500.05,\"description\":\"Initial Deposit\",\"document_data\":\"data:application/pdf;base64,$DOC\"}}"
curl -u '[email protected]:YourPassword' -d "$INVOICE" -H "Content-Type: application/json" -XPOST https://demo.s.portal.cohortgo.com/api/v1/services/payments/provider_invoices.json

Querying Uploaded Invoices

Listing invoices can be done via our GET /services/payments/provider_invoices endpoint. This can be filtered with an ?updated_since= timestamp, allowing for the incremental polling. Note that the data returned here is paginated, so if downloading a significant number of records, it is likely need to use the ?page=x parameter to work through the pages.

To retrieve the list of invoices:

curl -u '[email protected]:YourPassword' https://demo.s.cohortflow.com/api/v1/services/payments/provider_invoices.json

You'll note in the reply here that the outer payload looks like:

{"data":[...],"meta":{"page":1,"pages":1}}

The pages property here will be the key to look for in case the data you've retrieved is paginated.

Also note that all invoices known for your provider account are listed here - an invoice will go through the states [uploaded, awaiting_funds, funds_received, settled]. Note that depending upon how your provider account is configured, there may also be an awaiting_verification state between uploaded and awaiting_funds.

See the API Reference for more details on using the query endpoint and the data structure returned.

Demo

Here is the Demo of invoice creating and retrieving: https://demo.s.cohortflow.com/api/v1/services/payments/provider_invoices.json