Payments
Use ClubCollect as your payment provider
Start Payment
GET
https://app.clubcollect.com/api/v2/payments/:payment:method
This endpoint allows to start a new payment and redirects the user to the payment page.To start the payment session, the partner needs to generate the payment URL with the required parameters and add a signature to avoid tampering with data. Payments will always be linked to an invoice in ClubCollect. The invoice will be created ad hoc from the parameters received in the request, unless the partner provides the invoice_id
of an existing invoice to be paid. When the invoice_id
is given, the payment will be generated for the total amount due for the invoice. An invoice can have many associated payments and each call to the payments endpoint will result in a new payment. The invoices that are generated ad hoc are grouped in batches, per month.These batches can be found on :https://app.clubcollect.com/treasurer/import_batches
,named iDEAL (<year>-<month>)
by default, e.g. iDEAL (2019-08)
.
Path Parameters
Query Parameters
Signature
To ensure authenticity and data integrity of incoming payment requests ClubCollect requires these requests to be signed. This signature is based on a Hash-based Message Authentication Code (HMAC) calculated using a request's key-value pairs and a secret key, which is known only to the partner and ClubCollect.
Before sending a payment request to ClubCollect, the partner has to calculate the signature and add it as a request parameter. When a request comes in, ClubCollect calculates the same signature based on the received key-value pairs and the secret key. By verifying that both signatures are equal, ClubCollect ensures that the request is not tampered.
Similarly, the partner can validate responses from ClubCollect by calculating the corresponding signature and comparing it with the signature in the response.
Let's explain now how to calculate the signature step by step using the key-value pairs in the table below as example.
Note that code snippets are provided in Ruby.
partner API key: 3ac2bf2359c1eb184fe0fea01f624bc1d8581981
Discard key-value pairs for which value is null or an empty string
Sort the key-value pairs by key.
Concatenate every key-value pair on the list obtained in the previous step to get the signing string
Calculate SHA256 digest of the signing string
Calculate HMAC SHA-256 signature of digested signing string using the API key.
Encode the result from binary to hexadecimal
The signature calculated for the example key-value pairs and API key is:
After the signature is generated, it has to be appended to the url query string as
Payment response
Once the users finish the payment process, they are redirected to a result page of your choice, included in the payment request as redirect_url
.
ClubCollect will append parameters to this URL. payment_result
will inform the partner about the payment status. If the status is already determined (either authorised
or refused
or cancelled
), this information can be used to display a payment successful or payment failed or payment cancelled page.
In a case when the current status is pending
, the outcome of the payment will be communicated with payment notifications. Payments with status cancelled
may be authorized later by the payment provider.
The partner is encouraged to store the invoice_id
and payment_id
returned in ClubCollect responses and payment notifications, they will be needed to track the status of the payments. As an alternative, the partner can provide a unique external_invoice_number
parameter in the payment request and ClubCollect will include it on the response and notifications.
The payment_result
can have one of these values:
authorized
- the payment was successfully processed and accepted by the payment providerrefused
- the payment could not be processed due to invalid data introduced by the usercancelled
- the payee cancelled the payment or the payment session was ended by the payment provider due to inactivity of the payee.pending
- the payment is submitted for processing but the payment provider hasn't sent yet the resulterror
- the request was invalid or there was a general error on provider side (payment state is unknown)
Payment notifications
For some online payment methods such as iDEAL, the outcome of the payment request might take several hours to confirm. As soon as ClubCollect receives any update from the payment provider, a payment notification will be sent to the partner to communicate any change in the payment status.
Notifications are sent as HTTPS callbacks (webhooks) to an endpoint on your server. To receive notifications, you need a server that has:
An endpoint that can accept a JSON payload in an HTTP POST request.
An open TCP port for HTTPS traffic
This endpoint should be communicated to ClubCollect before going live with the payment integration.
The format of the JSON payload sent in the notifications is as follows:
Check status of a payment
GET
https://app.clubcollect.com/api/v2/payments/:id
ClubCollect will inform about any changes in the status using payment notifications. This endpoint can be used as a "backup" by the partner to check the current status of a payment in case any notification is dismissed. If at creation time you have provided a custom payment_id then you should use that identifier in this request.
Query Parameters
Payment notifications feed
GET
https://app.clubcollect.com/api/v2/payments/notifications
Returns a list containing the status of payments for a company, sorted from newest to oldest payments. It can be used by partners to catch up with notifications that might have been dismissed or not processed correctly.
Query Parameters
Last updated