Our API Docs just got a new look!

Create a subscription (Server2Server)

Create a new subscription with credit card details

post

This endpoint allows PCI merchants to create a new subscription with direct credit card details.

Header parameters
Content-TypestringRequired

Media type of the body sent to the API.

Default: application/json
X-Datestring · date-timeRequired

ISO8601 Datetime with Timezone (yyyy-MM-dd'T'HH:mm:ssZ)

X-LoginstringRequired

Merchant X-Login API Key.

AuthorizationstringRequired

Authorization control hash.

X-Idempotency-KeystringOptional

Unique idempotency key for ensuring that the same request is not processed more than once.

Body
invoice_idstringRequired

Unique identifier for the invoice

Example: INV123456
amountnumber · doubleRequired

Amount to be charged for the subscription

Example: 70
currencystringRequired

Three-letter currency code (ISO 4217)

Example: BRL
countrystringRequired

Two-letter country code (ISO 3166-1 alpha-2)

Example: BR
descriptionstringOptional

Description of the subscription

Example: Premium Subscription
client_ipstringOptional

IP address of the client

Example: 192.168.1.1
back_urlstring · uriOptional

URL to redirect after payment process

Example: https://example.com/back
success_urlstring · uriOptional

URL to redirect after successful payment

Example: https://example.com/success
error_urlstring · uriOptional

URL to redirect after failed payment

Example: https://example.com/error
notification_urlstring · uriOptional

URL to send payment status notifications

Example: https://example.com/notify
Responses
200

Subscription created successfully

application/json
post
POST /v3/subscriptions HTTP/1.1
Host: cc-api-stg.directa24.com
Content-Type: application/json
X-Date: 2025-08-29T15:40:08.849Z
X-Login: text
Authorization: text
Accept: */*
Content-Length: 680

{
  "invoice_id": "INV123456",
  "amount": 70,
  "currency": "BRL",
  "country": "BR",
  "payer": {
    "id": "PAYER123",
    "document": 123456789,
    "document_type": "CPF",
    "email": "[email protected]",
    "first_name": "Roberto",
    "last_name": "Carlos"
  },
  "description": "Premium Subscription",
  "subscription": {
    "start_date": "2025-01-01",
    "plan": "MONTHLY",
    "plan_unit": 1,
    "auto_renewal": false
  },
  "credit_card": {
    "cvv": "123",
    "card_number": "4111111111111111",
    "expiration_month": "12",
    "expiration_year": "25",
    "holder_name": "John Doe"
  },
  "client_ip": "192.168.1.1",
  "back_url": "https://example.com/back",
  "success_url": "https://example.com/success",
  "error_url": "https://example.com/error",
  "notification_url": "https://example.com/notify"
}
{
  "subscription_id": 358
}

Last updated

Was this helpful?