Subscription Payment

Create subscription payment

Changed on

Creates a Subscription.

Required scope: <code style="background:#e8f0fe;color:#1a73e8;padding:2px 8px;border-radius:12px;font-size:0.85em">subscription:create</code>

post/subscription

Request

  • Base URL
    https://api.test.easypay.pt/2.0
  • Auth
    API key in header AccountId and API key in header ApiKey

Request body

object required
frequent_id, string uuid

Only required to create a subscription from an active Frequent Payment.</br> Some properties like customer and sdd_mandate are inherited by the subscriptions.</br> So it's not necessary to send them in the request creation.

capture, object
expiration_time, string Y-m-d H:i

The last possible time to make the payment.</br> Required only when max_captures and/or unlimited_payments are NOT set.

currency, string

The currency code in ISO 4217 format (e.g., "EUR" for Euro). This field specifies the type of currency used in financial operation.

customer, Customer

The Customer object contains the necessary details about the customer involved in the transaction. This includes identification information, contact details, and preferences. All fields are optional unless specified otherwise.

key, string

The merchant's key for identifying the payment.

value, number double required

The payment value.</br>Will be rounded to 2 decimals.

frequency, '1D' | '1W' | '2W' | '1M' | '2M' | '3M' | '4M' | '6M' | '1Y' | '2Y' | '3Y' required

Defining the frequency that the cycles are charged.

max_captures, integer

Defining the total of cycles that will be charged.</br> Required only when expiration_time and/or unlimited_payments are NOT set.

unlimited_payments, boolean

When this property is set, unlimited cycles will be charged until the subscription is inactivated or deleted.

start_time, string Y-m-d H:i required

Defining the start of billing cycles.

failover, boolean

After all retries failed, the payment cycle can have another try with another single method.</br> For this, the customer needs a name, a valid email and a valid phone (we assume +351 when phone_indicative is empty). If any is missing, we reply with 412. This applies to the customer you send, the one in customer.id or the one from frequent_id.

capture_now, boolean

Whether to schedule an immediate capture and schedule the second one for start_time.

retries, integer

Number of tries for every cycle of payments.</br> The maximum number of retries that can occur will be determined by the frequency that is selected.</br> If a capture is unsuccessful for any reason, it will attempt to charge once more until the allotted number of attempts is reached.

method, 'CC' | 'DD' required

The payment methods.

sdd_mandate, SddMandate

The SDD Mandate object contains the necessary fields to create a SEPA Direct Debit mandate. This object ensures that all required information is provided to authorize and process SEPA Direct Debit transactions. Object required when method is Direct Debit.

Example request

{
  "frequent_id": "9234ef0f-b666-41cc-8ad2-5b54c1a84150",
  "expiration_time": "2037-12-12 16:05",
  "customer": {
    "id": "649e88cf-0b78-4c36-8f99-33f5ebb812a1",
    "name": "John Doe",
    "email": "john.doe@example.com",
    "phone": "911234567",
    "phone_indicative": "+351",
    "fiscal_number": "PT123456789",
    "key": "customer Key Example",
    "language": "PT"
  },
  "key": "Example Key",
  "value": 12.55,
  "start_time": "2027-01-11 16:05",
  "method": "CC",
  "sdd_mandate": {
    "iban": "PT50002700000001234567833",
    "key": "Sdd mandate Key Example",
    "name": "John Doe",
    "email": "john.doe@example.com",
    "phone": "911234567",
    "account_holder": "John Doe",
    "country_code": "PT",
    "max_num_debits": "12",
    "billing_entity": "PT16103627"
  }
}

Response

Created

SubscriptionResponseOnDetail required

Subscription object that returns after a success request.

id, string uuid
status, string
key, string
expiration_time, string date-time
start_time, string date-time
frequency, '1D' | '1W' | '2W' | '1M' | '2M' | '3M' | '4M' | '6M' | '1Y' | '2Y' | '3Y'
retries, integer
max_captures, integer
failover, boolean
capture_now, boolean
unlimited_payments, boolean
customer, CustomerResponseOnDetail

The Customer object contains detailed information about the customer involved in the transaction.

method, SubscriptionMethodResponseOnDetail
transactions, PaymentTransactions[]
currency, 'EUR'

ISO 4217 currency code. If not specified, the default currency is set to EUR.

value, number double
created_at, string date-time

Example response

{
  "id": "458b2fc4-3092-4de3-abd4-fe1600c09420",
  "status": "ok",
  "key": "payment 02536985",
  "expiration_time": "2099-01-15 00:00",
  "start_time": "2027-01-15 00:00",
  "retries": 2,
  "max_captures": 12,
  "customer": {
    "id": "1b4ca1cf-9a1a-415b-97bf-342c6ddcf9c1",
    "name": "Joey Price",
    "email": "john.doe@yahoo.com",
    "phone": "911234567",
    "phone_indicative": "+351",
    "fiscal_number": "PT921839198892623010",
    "key": "subscription 01234589",
    "language": "PT"
  },
  "method": {
    "url": "https://cc.easypay.pt/v3/public/card-details/cec55ab6-bda3-4ab3-af22-04d2ad2c046a",
    "last_four": "2222",
    "card_type": "VISA",
    "expiration_date": "07/29",
    "sdd_mandate": {
      "id": "50389142122",
      "iban": "PT50002700000001234567833",
      "key": "Sdd mandate Key Example",
      "name": "John Doe",
      "email": "john.doe@easypay.pt",
      "phone": "911345678",
      "account_holder": "John Doe",
      "country_code": "PT",
      "max_num_debits": "12",
      "billing_entity": "PT16103627",
      "reference_adc": "987654321123"
    }
  },
  "transactions": [
    {
      "id": "4fb3ac57-c7fe-4157-aeb7-4362ae24deec",
      "key": "Merchant identification key",
      "created_at": "2025-05-30T17:21:46Z",
      "date": "2025-05-30T17:21:47Z",
      "values": {
        "requested": 12.55,
        "paid": 12.55,
        "fixed_fee": 0.07,
        "variable_fee": 0.09,
        "tax": 0.04,
        "transfer": 12.35
      },
      "transfer_date": "2025-06-02T00:00:00Z",
      "method": "mbw",
      "document_number": "MARCEL0208220628294020250530172147",
      "descriptive": "Descriptive Josefa"
    }
  ],
  "currency": "EUR",
  "value": 10.55,
  "created_at": "2025-08-05 13:44:29"
}

Changes

    • info

      the request optional property sdd_mandate/billing_entity became read-only

    • info

      the response optional property method/sdd_mandate/billing_entity became read-only for the status