POST
/
Subscription
/
add
curl --request POST \
  --url https://api-sandbox.payabli.com/api/Subscription/add \
  --header 'Content-Type: application/json' \
  --header 'requestToken: <api-key>' \
  --data '{
  "entryPoint": "f743aed24a",
  "paymentMethod": {
    "initiator": "payor",
    "cardHolder": "John Cassian",
    "cardzip": "12345",
    "cardcvv": "123",
    "cardexp": "02/25",
    "cardnumber": "4111111111111111",
    "method": "card"
  },
  "paymentDetails": {
    "totalAmount": 100,
    "serviceFee": 0
  },
  "customerData": {
    "customerId": 4440
  },
  "scheduleDetails": {
    "planId": 1,
    "startDate": "09-20-2024",
    "endDate": "03-20-2025",
    "frequency": "weekly"
  }
}'
{
  "isSuccess": true,
  "responseText": "Success",
  "responseData": "396",
  "CustomerId": "4440"
}

Authorizations

requestToken
string
header
required

Most endpoints require an organization token. Some endpoints require an application token, and those endpoints are noted.

Headers

idempotencyKey
string

A unique ID you can include to prevent duplicating objects or transactions if a request is sent more than once. This key is not generated in Payabli, you must generate it yourself.

Example:

"6B29FC40-CA47-1067-B31D-00DD010662DA"

Query Parameters

forceCustomerCreation
boolean
default:false

When true, the request creates a new customer record, regardless of whether customer identifiers match an existing customer.

Body

A subscription must be linked to a customer, so if you don't include `CustomerId`, and the identifier fields in `customerData` don't match an existing customer, then a new customer is created and associated with the subscription. If you are using a stored payment method, then make sure the `storedMethodId` passed in the paymentMethod object belongs to the customer provided in customerData.
entryPoint
string | null
required

The entrypoint identifier.

Maximum length: 50
Example:

"d193cf9a46"

subdomain
string | null

Refers to the payment page identifier. If provided, then the transaction is linked to the payment page.

Maximum length: 50
Example:

"mypage-1"

source
string | null

Custom identifier to indicate the transaction or request source.

Maximum length: 100
Example:

"api"

setPause
boolean

Flag indicating if subscription is paused. When a subscription is paused, no payments are processed until the subscription is unpaused, and the next payment date is not calculated automatically. If you want to skip a payment instead, set the totalAmount to 0 in the paymentDetails object.

Example:

false

paymentMethod
object

Information about the payment method for the transaction. Required and recommended fields for each payment method type are described in each schema below.

paymentDetails
object

Object describing details of the payment. To skip the payment, set the totalAmount to 0. Payments will be paused until the amount is updated to a non-zero value. When totalAmount is set to 0, the serviceFee must also be set to 0.

customerData
object

Object describing the customer/payor.

invoiceData
object

Object describing an Invoice linked to the subscription.

scheduleDetails
object

Object describing the schedule for subscription.

Response

200
application/json
Success
isSuccess
boolean

Boolean indicating whether the operation was successful. A true value indicates success. A false value indicates failure.

Example:

true

responseText
string | null

Response text for operation: 'Success' or 'Declined'.

Example:

"Success"

responseData
object | null

If isSuccess = true, this contains the identifier of the subscription.

If isSuccess = false, this contains the reason for the failure."

Example:

"396"

CustomerId
integer | null

Payabli-generated unique ID of the customer the subscription belongs to.

Example:

"4440"

Was this page helpful?