Skip to main content
POST
/
credits
/
{customer_id}
/
rechargeSettings
Create a recharge setting
curl --request POST \
  --url https://api.metronome.com/v1/credits/{customer_id}/rechargeSettings \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "recharge_to_amount": 1000,
  "recharge_threshold": 300,
  "name": "Recharge top up grant",
  "priority": 100,
  "grant_duration": 6,
  "credit_type_id": "5ae401dc-a648-4b49-9ac3-391bb5bc4d7b",
  "prepaid_options": {
    "billing_provider_type": "stripe",
    "stripe_options": {
      "calculate_tax": true,
      "redirect_url": "https://example.com/action_required_redirect",
      "invoice_custom_fields": [
        {
          "name": "x_account_id",
          "value": "KyVnHhSBWl7eY2bl"
        }
      ],
      "invoice_metadata": {
        "ex_metadata1": "metadata value 1",
        "ex_metadata22": "metadata value 2"
      }
    }
  }
}'
{
  "data": {
    "id": "d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc"
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

customer_id
string<uuid>
required

Body

application/json

The recharge settings to set.

recharge_to_amount
number
required

the amount to recharge to

Required range: x >= 0
recharge_threshold
number
required

the threshold at which to recharge

Required range: x >= 0
name
string
required

the name of the credit grant as it will appear on invoices

priority
number
required
grant_duration
number
required

the duration (in months) for which the credits will be granted

credit_type_id
string<uuid>
required

the Metronome ID of the credit type to recharge

prepaid_options
object
required

Options for prepaid credits. If specified, the credits will not be released until payment is received.

enabled
boolean
recharge_now
boolean

If true, a recharge will be triggered immediately if the credit balance is under the recharge_threshold and the result of the recharge will be returned in the response. The settings will be updated regardless of the result of the recharge but the settings will have enabled set to 'false' if the recharge fails. An requires action result will be considered a failure for the purposes of this flag.

reason
string

Reason for the credit grant. This may be shown to your users.

credit_grant_type
string

Internal-only identifier used to categorize your credit grant. Your users won't see this.

product_ids
string<uuid>[]

The product(s) which these credits will be applied to. (If unspecified, the credits will be applied to charges for all products.). The array ordering specified here will be used to determine the order in which credits will be applied to invoice line items

Response

200 - application/json

Success

data
object
required
I