Skip to main content

Stripe Payments

If you’re using Stripe, you can simply install the RevGems App into your Stripe Account as described in the Setup Guide. Once you’ve done so, charges processed by Stripe will appear in your Message Log with type payment.

Other Payment Processors

You can track payments from all other platforms (PayPal, Chargebee, etc) by sending a payment message to the Tracking API. To do this you’ll need your Push Key Secret from your RevGems dashboard. When you make payment requests to the Tracking API, the payments will appear in your Message Log with type payment.

Request Headers

Requests made to this endpoint must have the following request headers.
Authorization
required
Your Push Key Secret provided as a Bearer token. See Authentication for details.
Content-Type
required
Must be application/json

Required Parameters

Requests made to this endpoint must have the following parameters in the JSON request body.
message_id
string
required
An arbitrary string identifier that functions as an idempotency key. Used to prevent the same message from being inadvertantly processed multiple times. We recommend using the payments unique ID in your own database or external payment process for this value.Example: Imagine a scenario where your payments are sent to RevGems on a background job. If the API request succeeds but the job fails for another reason, the job may be automatically retried in your system — possibly many times. As long as the same message_id is sent, RevGems will only track the payment once, regardless of how many times the request is sent.
account_id
string
required
The Account ID in your system that the payment is associated with. This must be the same ID you pass when tracking accounts.
type
string
required
Must be the literal value “payment”.
properties.amount_cents
integer
required
Amount collected by this payment. Must be a positive integer representing the amount in the smallest currency unit (e.g., 100 cents to charge $1.00 USD). For example, if the payment amount is $245.99, pass 24599.
properties.currency
string
required
The ISO 4217 currency code in which amount_cents is denominated (USD, EUR, etc).
Here’s an example request body using only the required parameters:
{
  "message_id": "payment-ABCD-DEFG",
  "accountId": "42",
  "type": "payment",
  "properties": {
    "amount_cents": 12300,
    "currency": "USD"
  }
}

Optional Parameters

The following parameters may optionally be in the JSON request body.
properties.id
string
The ID of the payment in your own database or external payment processor.
properties.description
string
A short description of the payment.
Here’s an example request body using the optional parameters:
{
  "message_id": "payment-ABCD-DEFG",
  "accountId": "42",
  "type": "payment",
  "properties": {
    "amount_cents": 12300,
    "currency": "USD",
    "id": "payment-ABCD-DEFG",
    "description": "Premium Subscription Renewal"
  }
}

Example Request

Here’s an example of a complete request using cURL:
curl -X POST 'https://t.revgems.com/messages' \
  --header 'Content-Type: application/json' \
  --data-raw $'{
  "message_id": "payment-ABCD-DEFG",
  "accountId": "42",
  "type": "payment",
  "properties": {
    "amount_cents": 12300,
    "currency": "USD",
    "id": "payment-ABCD-DEFG",
    "description": "Premium Subscription Renewal"
  }
}' \
  --header 'Authorization: Bearer push_secret_test_ABCD1234'

Example Responses

201 Created
{
  "success": true,
  "authentication": "secret",
  "test_mode": true
}
401 Unauthorized
{
  "success": false,
  "errors": [
    "Invalid push key."
  ]
}
422 Unprocessable Content
{
  "success": false,
  "errors": [
    "Properties `amount_cents` is not an integer",
    "Properties `currency` is not a valid currency"
  ]
}