Looking for ePay classic docs? Go to docs.epay.dk
ePay documentationDocsePay documentation
Subscription Billing

Get Billing Agreement

GET
/public/api/v1/subscriptions/billing/agreements/{agreementId}

Returns the specific billing agreement from its id

Authorization

BearerAuth
AuthorizationBearer <token>

In: header

Path Parameters

agreementIdstring
Required

The id of the agreement to fetch.

Response Body

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/public/api/v1/subscriptions/billing/agreements/string"
{  "billingAgreement": {    "id": "019a729e-2d93-7612-9329-8f783f66f834",    "billingPlanId": "019a729e-41c2-7d16-a1e2-fdb15a8146bb",    "subscriptionId": "019a729e-51ed-7426-b7c9-0e212b2d77d4",    "sessionId": "019a729e-660a-7a05-90ad-5160ad0decc5",    "customerId": "user-1",    "nextChargeAt": "2030-08-29T15:51:28.071Z",    "lastChargeAt": "2030-07-29T15:51:28.071Z",    "desiredDate": 30,    "state": "PENDING",    "stateChangedAt": "2030-07-29T15:51:28.071Z",    "reference": "agreement-1",    "createdAt": "2030-07-29T15:51:28.071Z"  }}
{  "errorCode": "SERVER_ERROR",  "message": "An unexpected system error"}
{  "errorCode": "VALIDATION_ERROR",  "message": "Input validation errors",  "errors": {    "amount": [      "[required]: Is a required non-nullable field",      "[int]: Must be an integer",      "[min:0]: Must be greater than 0",      "[max:999999999]: Must be less than 999999999"    ]  }}
{  "errorCode": "SERVER_ERROR",  "message": "An unexpected system error"}

Create Billing Agreement

Creates a new Billing Agreement based on an existing Subscription and a Billing Plan . A billing agreement represents a scheduled payment relationship between the merchant and the cardholder, managed automatically by ePay. It links a subscription and a plan together, allowing ePay to handle recurring charges according to the plan’s configuration - for example, charging the customer monthly based on the defined price and interval. Important: Billing agreements is an optional extension of the base subscription and is only necessary if you want ePay to automatically manage recurring or interval-based billing on your behalf. If you only need to perform unscheduled MIT (Merchant-Initiated Transaction) payments - meaning you trigger the charge manually via the API whenever needed - you do not need to create a billing agreement or billing plan. In that case, use the existing Subscription created through the Initialize Payment Session /cit endpoint, and perform MIT transactions directly. Relationship to other components - Subscription: The underlying link between a merchant and a stored payment method. Created via the Initialize Payment Session /cit endpoint by sending the Subscription object. - Billing Plan: Defines recurring details like price, interval, and retry policy. Used only when ePay manages the billing schedule automatically. - Billing Agreement: Connects a Subscription to a Billing Plan. Tracks scheduled processing and charge lifecycle. - Billing Agreement Charge: Represents a scheduled billing event created from an agreement. Each charge can have multiple transaction attempts and a completion deadline. - Transaction: The base payment model used for all processing. Charges and transactions are linked to maintain attempt history.

Stop Billing Agreement

Stop automatic billing charges for the given billing agreement. No more automatic charges will be made for the agreement, until /resume is called.