Subscriptions: Create

Request

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

Parameters:

Parameters
transaction_token_idstring (UUID) [Required]
Id of the Transaction Token use. Must be either a subscription or recurring type transaction token.
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, quarterly, semiannually, annually. If this field is populated, cyclical_period cannot be populated
cyclical_periodstring (ISO-8601 Duration)
Frequency at which the subscription is charged, expressed as an ISO-8601 duration, with a minimum frequency of 1 day and a minimum interval of 1 day. If this field is populated, period cannot be populated
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
schedule_settings.termination_modestring
One of immediate, on_next_payment
Default is immediate if unspecified.
When the value is immediate, the subscription will suspend or terminate immediately, whereas for on_next_payment, it will only suspend or terminate right before the next payment.
installment_plan.plan_typestring
One of revolving, fixed_cycles
installment_plan.fixed_cyclesnumber
If installment_plan.plan_type is fixed_cycles, then this field is required. Specifies the number of cycles, in the installment
subscription_plan.plan_typestring
One of fixed_cycles, fixed_cycle_amount
subscription_plan.fixed_cyclesnumber
If subscription_plan.plan_type is fixed_cycles, then this field is required. Specifies the number of cycles, in the subscription plan
subscription_plan.fixed_cycle_amountnumber
If subscription_plan.plan_type is fixed_cycle_amount, then this field is required. Specifies the amount per cycle, in the subscription plan
schedule_settings.retry_intervalstring (ISO-8601 Duration)
Specifies the interval between retries when subscription payment fails.
ex) P5D: Retry every 5 days after failure

*Interval must be at least 1 day and must be shorter than the subscription cycle.
metadatajson
Metadata associated with the subscription.
three_ds.redirect_endpointstring (URL)
The redirect endpoint when the client is returns from 3DS authentication. If not set, the user will be shown a generic completion page and asked to return manually to the originating website.

Note: This only affects the first payment of the subscription
three_ds.modestring
The 3DS authentication mode for the charge. One of normal, required, force, skip.

Note: This only affects the first payment of 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
}