Register Subscription
Allows you to register information to generate a subscription along with the customer's information.
Method
POST
URL
https://b61cr11gvd.execute-api.us-east-1.amazonaws.com/v1/api/payment/suscription
Request Headers
Name | Type | Description |
---|---|---|
Authorization* | string | Bearer Token |
Request Body
Field | Structure | Type | Required | Description |
---|---|---|---|---|
hash* | string | Yes | Hash generated in /payment/create | |
plan_id | string | Yes | Plan ID that will be assigned to the customer to activate the subscription. | |
start_date | string | No | Subscription start date in DD/MM/YYYY format. If not provided, the invocation date will be assigned. This date corresponds to the first payment and marks the beginning of the subscription payment frequency. If payment is by credit card, this date will be taken as today's date. | |
customer | struct | Yes | Structure with the user information to whom the subscription will be sent | |
customer | string | Yes | Customer email. Must comply with the standard valid email format. | |
user_di | customer | string | Yes | Customer ID number. |
type_di | customer | string | Yes | Customer ID type. |
first_name | customer | string | Yes | Customer first name on the ID (does not accept special characters or accents). |
last_name | customer | string | Yes | Customer last name on the ID (does not accept special characters or accents). |
cellphone | customer | string | Yes | Customer cell phone number. Must include the country code. |
credit_card_data | struct | No | Structure to activate automatic card debit. | |
card_number | credit_card_data | string | Yes (automatic debit active) | Card number. |
cvv | credit_card_data | int | Yes (automatic debit active) | Card security code. |
expiration_date | credit_card_data | string | Yes (automatic debit active) | Card expiration date in MM/YY format. |
retries | credit_card_data | int | No | Defines the number of times a payment is retried if it fails (e.g., insufficient funds). Default value: 1. Allowed values: between 0 and 4. If greater than 1, retries are made every day, as long as the processor allows it. |
franchise | credit_card_data | string | Yes (Automatic Debit Active) | Defines the card's deductible. |
id_type | credit_card_data | string | Yes (Automatic Debit Active) | Type of ID of the person making the transaction. |
id | credit_card_data | string | Yes (Automatic Debit Active) | ID number of the person making the transaction. |
holder_name | credit_card_data | string | Yes (Automatic Debit Active) | Cardholder's first name, without last name. |
holder_last_name | credit_card_data | string | Yes (Automatic Debit Active) | Cardholder's last name. |
credit_card_data | string | Yes (Automatic Debit Active) | Email address of the person making the transaction. | |
phone | credit_card_data | string | Yes (Automatic Debit Active) | Phone number of the person making the transaction, without callsigns. |
ip | credit_card_data | string | Yes (Automatic Debit Active) | IP address of the end-user's device originating the transaction. |
header_user_agent | credit_card_data | string | Yes (Automatic Debit Active) | User_agent header of the user's browser. |
line1 | credit_card_data | string | Yes (Automatic Debit Active) | Line 1 associated with the user's billing address. |
line2 | credit_card_data | string | Yes (automatic debit active) | Line 2 associated with the user's billing address. |
line3 | credit_card_data | string | Yes (auto debit active) | Line 3 associated with the user's billing address. |
country | credit_card_data | string | Yes (auto debit active) | User's country. |
city | credit_card_data | string | Yes (auto debit active) | User's city. |
state | credit_card_data | string | Yes (auto debit active) | User's state or department. |
post_code | credit_card_data | string | Yes (auto debit active) | User's postal code. |
customer_id | string | No | Unique identifier for a user with an existing subscription. When creating a new subscription, you can use the customer_id to avoid resubmitting user and card information. With the customer_id field in the request, the customer and credit_card_data structures are not required. |
Request (example)
{
"hash": "",
"plan_id": "1da2c872-3047-4625-9507-22d7a1bd045e",
"start_date": "28/10/2024",
"customer": {
"first_name": "user-name",
"last_name": "last-name",
"user_di": "999999999",
"type_di": "CC",
"cellphone": "+57112321131331",
"email": "user@example.com"
}
}
Response Codes
- 202: Accepted Payment
- 406: Payment declined
- 422: Unprocessable Entity - The body sent is not correct
- 401: Unauthorized - Header Authorization not sent
- 401: Unauthorized - Token malformation
Response (example)
{
"status": {
"code": 202,
"message": "success",
"kind": "unknown"
},
"data": {
"CODE": "0000",
"DESC": "OK",
"DATA": {
"id": "b45fd212-2c26-4068-9807-2c9c6b8ac204",
"start_date": "14/06/2023",
"status": "ACTIVE",
"plan": {
"id": "50e25c83-12ba-442f-adf8-6d410b376045"
},
"customer": {
"id": "b45fd212-2c26-4068-9807-2c9c6b8ac204"
}
}
}
}
For days that do not exist in months where a payment is due, for example the 31st, the deadline for making the subscription payment will be the last day of that month.