Subscriptions: Create

Request

POST https://api.univapay.com/subscriptions

Parameters:

Parameters
transaction_token_idstring (UUID) [Required]
Id of the Transaction Token use. Must have the subscription flag set to true.
amountnumber [Required]
Amount to charge
currencystring (ISO-4217) [Required]
Currency code in ISO-4217.
initial_amountnumber
Initial amount to charge, if different from the recurring amount
periodstring
Frequency at which the subscription is charged. One of daily, weekly, biweekly, monthly, annually
schedule_settings.start_onstring (ISO-8601)
The date in which all subsequent payments should start on in Year-Month-Day format. Time is fixed to 9am of the timezone declared in zone_id
schedule_settings.zone_idstring (IANA Timezone)
The timezone the subscription will be charged at
schedule_settings.preserve_end_of_monthboolean
If the period is monthly and the start_on date provided is the last day of the month, this option allows the charge to follow the end of the month. E.g. If start_on is 2018-06-30, then the next charge is 2018-07-31 if true and 2018-07-30 if false
installment_plan.plan_typestring
One of revolving, fixed_cycles, fixed_cycle_amount
installment_plan.fixed_cyclesnumber
If plan_type is fixed_cycles, then this field is required. Specifies the number of cycles, in the installment
installment_plan.fixed_cycle_amountnumber
If plan_type is fixed_cycle_amount, then this field is required. Specifies the amount per cycle, in the installment
metadatajson
Metadata associated with the subscription.

Headers:

Content-Type: application/json
Authorization: Bearer {secret}.{jwt}

Body:

curl --request POST \
--url https://api.univapay.com/subscriptions \
--header 'Authorization: Bearer {secret}.{jwt}' \
--header 'content-type: application/json' \
--data '{
  "transaction_token_id": "a6025e32-18e3-11e7-8fc4-17c907a37445",
  "amount": 1250,
  "currency": "USD",
  "period": "daily",
  "metadata":{
      "ServiceId": 78435694
  }
}'

Response

Code: 201

Headers:

Content-Type: application/json

Body:

{
  "id": "aaadee6a-18e3-11e7-a461-e3b078a7dc52",
  "store_id": "37ff5664-18c6-11e7-8221-ff4914d76afc",
  "amount": 1250,
  "currency": "USD",
  "amount_formatted": 12.5,
  "period": "daily",
  "status": "unverified",
  "metadata": {
    "ServiceId": 78435694
  },
  "mode": "test",
  "created_on": 1491275175825
}