create
Use the create API to initiate a subscription creation request. After this API is called successfully, you can get the authorization URL and redirect the user to the URL to authorize the subscription. After the user authorizes the subscription successfully, Antom initiates an automatic deduction in each subscription period and notifies you of the payment result.
Structure
A message consists of a header and body. The following sections are focused on the body structure. For the header structure, see:
Note: Set the data type of each field (except array) as String. This means that you must use double quotation marks (" ") to enclose the field value. Examples:
- If the data type of a field is Integer and its value is 20, set it as "20".
- If the data type of a field is Boolean and its value is true, set it as "true".
Request parameters
subscriptionRequestId String REQUIRED
The unique ID assigned by a merchant to identify a subscription request. Antom uses this field for idempotency control.
More information:
- This field is an API idempotency field.For subscription requests that are initiated with the same value of subscriptionRequestId and reach a final status of S or F, the same result is to be returned for the request.
- Maximum length: 64 characters
subscriptionDescription String REQUIRED
The description of the subscription, used for displaying user consumption records and other actions.
More information:
- Maximum length: 255 characters
subscriptionRedirectUrl URL REQUIRED
The merchant page URL that the user is redirected to after authorizing the subscription.
More information:
- Maximum length: 2048 characters
subscriptionStartTime Datetime REQUIRED
The date and time when the subscription becomes active.
More information:
- The value follows the ISO 8601 standard format. For example, "2019-11-27T12:01:01+08:00".
subscriptionEndTime Datetime
The date and time when the subscription ends.
Specify this parameter when you want to designate the subscription end time.
More information:
- The value follows the ISO 8601 standard format. For example, "2019-11-27T12:01:01+08:00".
periodRule PeriodRule REQUIRED
The subscription period rule, used to define a subscription's billing period.
subscriptionExpiryTime Datetime
A specific date and time after which the created subscription expires. When the subscription expires, the order must be terminated. The default value of this parameter is 30 minutes after the subscription creation request is sent.
Specify this parameter if you want to designate the subscription creation expiration time. The specified payment expiration time must be less than 48 hours after the subscription request is sent.
More information:
- The value follows the ISO 8601 standard format. For example, "2019-11-27T12:01:01+08:00".
paymentMethod PaymentMethod REQUIRED
The payment method that is used to collect the payment by the merchant or acquirer.
subscriptionNotificationUrl URL
The URL that is used to receive the subscription result notification.
You can also configure the subscription notification URL in Antom Dashboard. If you specify this URL in both this API and Antom Dashboard, the URL configured in the API takes precedence.
Only one subscription notification URL can be configured in Antom Dashboard.
More information:
- Maximum length: 2048 characters
paymentNotificationUrl URL
The URL that is used to receive the payment result notification for each subscription period.
You can also configure the subscription notification URL in Antom Dashboard. If you specify this URL in both this API and Antom Dashboard, the URL configured in the API takes precedence.
You can only configure one subscription notification URL in Antom Dashboard.
More information:
- Maximum length: 2048 characters
orderInfo OrderInfo REQUIRED
The order information for the subscription. This field is used for different purposes:
- During the payment process, this field is mainly used by Antom for risk control or anti-money laundering.
- After the payment is completed, this field is used for recording and reporting purposes such as purchase tracking and regulatory reporting.
paymentAmount Amount REQUIRED
The payment amount charged to the user per subscription period.
settlementStrategy SettlementStrategy REQUIRED
The settlement strategy for the payment request.
env Env REQUIRED
Information about the environment where the order is placed, such as the device information.
trials Array<Trial>
The list of trial information of a subscription.
Specify this parameter if the subscription includes any trial periods.
More information:
- Maximum size: Unlimited
merchantAccountId String REQUIRED
The unique ID to identify a merchant account.
More information:
- Maximum length: 64 characters