Create transaction

POST https://api.ecurring.com/transactions

Even though generally your subscription plan will schedule the transactions for you, sometimes it can be useful to manually add a transaction to a subscription. Particularly in the case where the transaction amount is variable.

The transaction will be retried as many times as configured in the subscription plan.

Because of the asynchronous nature of our transaction scheduler, the transaction may possible not immediately be available after creation and the status will always be queued in the response. An immediate request to the Get transaction endpoint for this transaction after creation may result in a 404.

Note that a relationship from a transaction to a subscription is currently not available, as transaction identifiers can only be retrieved through the List subscription transactions endpoint.

Attributes

subscription_id
integer
The identifier of the subscription. The identifer can be retrieved through the List subscriptions endpoint.
amount
double
The amount of the transaction, in Euro.
due_date
datetime
Optional - The date on which the transaction should be executed. Usually a transaction will be fulfilled within 3 days of this date. If this is left empty then the current date will be used. In ISO 8601 format.
description
string
Optional - The description of the transaction. This will be shown to your customer on their card or bank statement when possible. We truncate the description automatically according to the limits of the used payment method. Subscription plan (product) name will be used when left empty.

Examples

Scheduling a transaction in the future

This will create a transaction with a due_date in the future.

POST /transactions HTTP/1.1
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json
{
    "data": {
        "type": "transaction",
        "attributes": {
        	"subscription_id": "1",
        	"amount": 34.50,
        	"due_date": "2019-01-01T00:00:00+01:00",
            "description": "Payment for invoice #2F201212"
        }
    }
}

Response

HTTP/1.1 201 Created
Content-Type: application/vnd.api+json
{
    "links": {
        "self": "https://api.ecurring.com/transactions/ffa38848-6abc-4d22-b6b0-63fe1780969c"
    },
    "data": {
        "type": "transaction",
        "id": "ffa38848-6abc-4d22-b6b0-63fe1780969c",
        "links": {
            "self": "https://api.ecurring.com/transactions/ffa38848-6abc-4d22-b6b0-63fe1780969c"
        },
        "attributes": {
            "status": "queued",
            "scheduled_on": null,
            "due_date": "2019-01-01T00:00:00+01:00",
            "amount": 34.50,
            "canceled_on": null,
            "webhook_url": null,
            "payment_method": "directdebit",
            "description": "Payment for invoice #2F201212",
            "history": []
        }
    }
}

Scheduling a transaction immediately

This will create a transaction with the current date as due_date, resulting in the transaction being executed today.

POST /transactions HTTP/1.1
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json
{
    "data": {
        "type": "transaction",
        "attributes": {
        	"subscription_id": "1",
        	"amount": 50
        }
    }
}

Response

HTTP/1.1 201 Created
Content-Type: application/vnd.api+json
{
    "links": {
        "self": "https://api.ecurring.com/transactions/ffa38848-6abc-4d22-b6b0-63fe1780969c"
    },
    "data": {
        "type": "transaction",
        "id": "ffa38848-6abc-4d22-b6b0-63fe1780969c",
        "links": {
            "self": "https://api.ecurring.com/transactions/ffa38848-6abc-4d22-b6b0-63fe1780969c"
        },
        "attributes": {
            "status": "queued",
            "scheduled_on": null,
            "due_date": "2018-01-30T00:00:00+01:00",
            "amount": 50,
            "canceled_on": null,
            "webhook_url": null,
            "payment_method": "directdebit",
            "description": null,
            "history": []
        }
    }
}