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

Create Billing Agreement

POST
/public/api/v1/subscriptions/billing/agreements

Authorization

BearerAuth
AuthorizationBearer <token>

In: header

Request Body

application/json

Create billing agreement data

TypeScript Definitions

Use the request body type in TypeScript.

billingPlanIdstring
Required

Identifier for the associated billing plan.

Format:
uuid
subscriptionIdstring
Required
Format:
uuid
Example:
null

Optional reference string.

Example:
"agreement-1"
stringstring

Optional reference string.

Example:
"agreement-1"
nullnull

Optional reference string.

Example:
"agreement-1"
Format:
date
Example:
"2030-07-29"
stringstring
Format:
date
Example:
"2030-07-29"
nullnull
Format:
date
Example:
"2030-07-29"

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/public/api/v1/subscriptions/billing/agreements" \  -H "Content-Type: application/json" \  -d '{    "billingPlanId": "13568ff4-f6e3-4ead-8359-ef949748a0cf",    "subscriptionId": null  }'
{  "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"}