The Cohort Go payments platform enables third-party providers to directly a link to Cohort Go Payments on their payment page. This link enables seamless transfer of customer details to Cohort Go where they will be able to finalise their payment.
To establish an external integration, Cohort requires the following information:
A payment is initiated by having the user perform a POST request to https://payments.cohortgo.com/invoice. Generally, we would expect this this to be driven by a "Pay with Cohort Go" button on the partner's payment page.
A sample form to drive this button might look like:
<form action="https://payments.cohortgo.com/invoice" method="POST">
<input name="partner" type="hidden" value="example-partner" />
<input name="locale" type="hidden" value="en" />
<input
name="cancel_url"
type="hidden"
value="http://example.com/app/INV0001/cancel"
/>
<input
name="completion_url"
type="hidden"
value="http://example.com/app/INV0001/completed"
/>
<input name="timestamp" type="hidden" value="20171120031112" />
<input
name="fingerprint"
type="hidden"
value="8cb2237d0679ca88db6464eac60da96345513964"
/>
<input name="email" type="hidden" value="[email protected]" />
<input name="given_name" type="hidden" value="First" />
<input name="family_name" type="hidden" value="Last" />
<input name="dob" type="hidden" value="2000-01-01" />
<input name="phone1" type="hidden" value="0412123123" />
<input name="home_country" type="hidden" value="CN" />
<input name="passport_country" type="hidden" value="CN" />
<input name="passport_number" type="hidden" value="M1231234" />
<input name="invoice" type="hidden" value="INV00001" />
<input name="description" type="hidden" value="Tuition Deposit" />
<input name="due" type="hidden" value="2017-11-30" />
<input name="amount" type="hidden" value="500.0" />
<input
name="document_url"
type="hidden"
value="http://example.com/invoices/doc.pdf"
/>
<button type="submit">Pay with Cohort Go</button>
</form>
The hidden fields included in this can be broken down into a 3 distinct sections. Setting up the integration, providing details of the customer and providing details of the invoice.
For setting up the integration:
YYYYmmddHHMMss
representing the current time;hex(sha1(timestamp '|' secret '|' invoice '|' amount))
(where amount is formatted as XXX.XX);For the student details:
For the invoice details:
Successful integration with the Cohort Go payments system requires the implementation of a number of API endpoints.
The Cohort Go system can notify a partner system when funds are received in a foreign currency, as well as when funds have been sent domestically to the partner's bank account. This notification is delivered as a JSON POST to a pre-agreed endpoint (the Update Notification Endpoint established during the setup).
For a funds received notification, a payload would look like:
{
"invoice": "INV0001",
"state": "funds_received",
"transaction": "CPS12341234",
"timestamp": "20171120023800",
"fingerprint": "7e240de74fb1ed08fa08d38063f6a6a91462a815",
"amount": 500.0,
"cleared_funds": true
}
Points of note in this notification:
amount
field may be lower than the original requested amount;cleared_funds
field will be false
in cases where Cohort Go still needs to complete a process of clearing funds with local regulators. It may be possible in these cases that additional information might be needed from the customer to finalise the payment, or further that the payment may need to be cancelled. It is recommended that if you are performing immediate processes based upon a funds_received
notification that these processes wait until a "cleared_funds": true
value is received. If an initial notification is sent with "cleared_funds": false
, then an updated notification will be sent with "cleared_funds": true
once this process completes. In some circumstances such as delivery failures, it may be possible that a settled
notification will be sent first - in this case, it can be safely assumed that funds did clear.For a completion notification, a payload would look like:
{
"invoice": "INV0001",
"state": "settled",
"transaction": "CPS12341234",
"timestamp": "20171120023800",
"fingerprint": "7e240de74fb1ed08fa08d38063f6a6a91462a815",
"amount": 500.0
}
For the fields in each of these notifications:
hex(sha1(timestamp '|' secret '|' invoice '|' transaction '|' amount))