Skip to main content

/plan/{plan_id}

Update Plan Configuration

(PUT /plan/<plan_id>)

The only fields that can currently be modified are: amount, method, periodicity, and the last event date.

Any fields contained within the payment method, such as token, iban, scheme, etc., can be modified individually as long as the payment method type is not changed, for example, from card to debit.

If a payment method change is made, all mandatory fields for that specific method must be filled out.

Mandatory fields for the card type are: token Mandatory fields for the debit type are: iban, signed_at, and scheme.

When changing the billing period, it is important to note that if this change is made 1 day before the next scheduled event, it will affect the calculation of the next event. For example, if a scheduled event is to be launched on 2017-09-07, the deadline for the change in periodicity to affect the next event would be 2017-09-06. Otherwise, the change will take effect for the following event.

When modifying the last event date, the deadline is also up to 1 day before processing; otherwise, it could affect the next calculated event. For example, if an event is scheduled to launch on 2017-09-07, the deadline to modify that event would be 2017-09-06. After that date, you would be modifying the next calculated event.

Important: Changes to the payment method and amount will take effect if made at least 1 day in advance of the event processing date.

Important: If an event is in process, it cannot be modified.

Request Body

  • amount (integer): Fixed amount associated with the plan. It can be a string or an integer with a maximum of 10 digits, for example, "0000000100" or 100, both representations result in 1.00€. 100
    • Restrictions:
      • Maximum length: 10
      • Minimum length: 1
      • Minimum value: 1
      • Maximum value: 9999999999
  • method (object): Information related to the payment method
    • type (string): Type of method
      • debit
      • card
    • token (string): Card identifier. This field is mandatory if the method is card. card-token-123456
      • Restrictions:
        • Pattern: [\w-]
        • Minimum length: 6
        • Maximum length: 128
    • iban (string): Identifier of the bank account. Mandatory if the chosen method is debit. ES42587462354158786693215
      • Restrictions:
        • Pattern: [A-Z]2[0-9]32
        • Minimum length: 14
        • Maximum length: 34
    • mandate (object): Information related to the mandate. This information is mandatory if the chosen method is debit.
      • signed_at (string): Date and time of mandate signing 2016-01-25 14:06:55
        • Restrictions:
          • Format: yyyy-mm-dd HH:MM:SS
      • reference (string): Identifier of the mandate, granted by the commerce, which serves as a reference against their systems. reference-id-12456
        • Restrictions:
          • Pattern: [\w-]
          • Maximum length: 64
          • Minimum length: 1
      • scheme (enum[string]): Type of direct SEPA debit
        • CORE
      • periodicity (string, required): String that indicates the periodicity with which the amount associated with the plan will be charged. It will be indicated by a number followed by any of the following letters: "d", "w", "m", and "y" indicating days, weeks, months, and years respectively. 1m
      • Restrictions:
        • Pattern: [1-9](?:[0-9]+)?[dwmy]
      • throw_at (string): Processing date of the last event one day in advance; for example, if today is 2016-09-05, only dates equal to or greater than 2016-09-06 can be defined. 2016-09-08
      • Restrictions:
      • Format: yyyy-mm-dd

Changing payment method to card example

{
"key": "{{api-key}}",
"resource": "{{resource-key}}",
"nonce": "1234567890",
"mode": "sha256",
"payload": {
"method": {
"type": "card",
"token": "card-token-123456"
}
}

}

Changing payment method to debit example

{
"key": "{{api-key}}",
"resource": "{{resource-key}}",
"nonce": "1234567890",
"mode": "sha256",
"payload": {
"method": {
"type": "debit",
"iban": "ES1234567891234567891234",
"mandate": {
"signed_at": "2016-01-28 14:06:55",
"reference": "client-reference-123465",
"scheme": "core"
}
}
}
}

Individual changes to a card plan example

{
"key": "{{api-key}}",
"resource": "{{resource-key}}",
"nonce": "1234567890",
"mode": "sha256",
"payload": {
"amount": 1000,
"method": {
"token": "card-token-654321"
}
}
}
}

Individual changes to a debit plan example

{
"key": "{{api-key}}",
"resource": "{{resource-key}}",
"nonce": "1234567890",
"mode": "sha256",
"payload": {
"amount": 1000,
"method": {
"iban": "ES1234567891234567891234",
"mandate": {
"scheme": "CORE"
}
}
}
}
}

Response - success

{
"description": "Unknown",
"code": "X-XXXX",
"type": "unknown",
"request_id": null,
"detail": "plan_retrieved",
"uuid": "8ee7cf68-9e22-4fd2-8da4-bfd919ca0750",
"payload": {
"amount": 1000,
"fees": 12,
"description": "Annual playstation subscription",
"name": "12654-playstation-subscription",
"expired_at": null,
"plan_id": "5976fc0dc928580001cc5dd8",
"custom_data": {
"dummy": "foo"
},
"method": {
"type": "card",
"token": "card-token-65432",
},
"periodicity": "1m",
"resource": "resource-example-key",
"currency": "EUR",
"deleted_at": null,
"customer": {
"taxid": "29724381D",
"reference": "client-123465",
"name": "John Doe Sullivan"
},
"start_date": "2016-01-25",
"external_id": "external-reference-123456"
}
}