subscriptionGroupInvoiceAccountController := client.SubscriptionGroupInvoiceAccountController()
SubscriptionGroupInvoiceAccountController
- Create Subscription Group Prepayment
- List Prepayments for Subscription Group
- Issue Subscription Group Service Credit
- Deduct Subscription Group Service Credit
A prepayment can be added for a subscription group identified by the group's uid
. This endpoint requires a amount
, details
, method
, and memo
. On success, the prepayment will be added to the group's prepayment balance.
CreateSubscriptionGroupPrepayment(
ctx context.Context,
uid string,
body *models.SubscriptionGroupPrepaymentRequest) (
models.ApiResponse[models.SubscriptionGroupPrepaymentResponse],
error)
Parameter | Type | Tags | Description |
---|---|---|---|
uid |
string |
Template, Required | The uid of the subscription group |
body |
*models.SubscriptionGroupPrepaymentRequest |
Body, Optional | - |
models.SubscriptionGroupPrepaymentResponse
ctx := context.Background()
uid := "uid0"
apiResponse, err := subscriptionGroupInvoiceAccountController.CreateSubscriptionGroupPrepayment(ctx, uid, nil)
if err != nil {
log.Fatalln(err)
} else {
// Printing the result and response
fmt.Println(apiResponse.Data)
fmt.Println(apiResponse.Response.StatusCode)
}
{
"id": 6049554,
"amount_in_cents": 10000,
"ending_balance_in_cents": 5000,
"entry_type": "Debit",
"memo": "Debit from invoice account."
}
HTTP Status Code | Error Description | Exception Class |
---|---|---|
422 | Unprocessable Entity (WebDAV) | ErrorListResponseException |
This request will list a subscription group's prepayments.
ListPrepaymentsForSubscriptionGroup(
ctx context.Context,
input ListPrepaymentsForSubscriptionGroupInput) (
models.ApiResponse[models.ListSubscriptionGroupPrepaymentResponse],
error)
Parameter | Type | Tags | Description |
---|---|---|---|
uid |
string |
Template, Required | The uid of the subscription group |
page |
*int |
Query, Optional | Result records are organized in pages. By default, the first page of results is displayed. The page parameter specifies a page number of results to fetch. You can start navigating through the pages to consume the results. You do this by passing in a page parameter. Retrieve the next page by adding ?page=2 to the query string. If there are no results to return, then an empty result set will be returned. Use in query page=1 .Default: 1 Constraints: >= 1 |
perPage |
*int |
Query, Optional | This parameter indicates how many records to fetch in each request. Default value is 20. The maximum allowed values is 200; any per_page value over 200 will be changed to 200. Use in query per_page=200 .Default: 20 Constraints: <= 200 |
filter |
*models.ListPrepaymentsFilter |
Query, Optional | Filter to use for List Prepayments operations |
models.ListSubscriptionGroupPrepaymentResponse
ctx := context.Background()
collectedInput := advancedbilling.ListPrepaymentsForSubscriptionGroupInput{
Uid: "uid0",
Page: models.ToPointer(2),
PerPage: models.ToPointer(50),
Filter: models.ToPointer(models.ListPrepaymentsFilter{
DateField: models.ToPointer(models.ListPrepaymentDateField("created_at")),
StartDate: models.ToPointer(parseTime(models.DEFAULT_DATE, "2024-01-01", func(err error) { log.Fatalln(err) })),
EndDate: models.ToPointer(parseTime(models.DEFAULT_DATE, "2024-01-31", func(err error) { log.Fatalln(err) })),
}),
}
apiResponse, err := subscriptionGroupInvoiceAccountController.ListPrepaymentsForSubscriptionGroup(ctx, collectedInput)
if err != nil {
log.Fatalln(err)
} else {
// Printing the result and response
fmt.Println(apiResponse.Data)
fmt.Println(apiResponse.Response.StatusCode)
}
{
"prepayments": [
{
"prepayment": {
"id": 142,
"subscription_group_uid": "grp_b4qhx3bvx72t8",
"amount_in_cents": 10000,
"remaining_amount_in_cents": 10000,
"details": "test",
"external": true,
"memo": "test",
"payment_type": "cash",
"created_at": "2023-06-21T04:37:02-04:00"
}
}
]
}
HTTP Status Code | Error Description | Exception Class |
---|---|---|
404 | Not Found | ApiError |
Credit can be issued for a subscription group identified by the group's uid
. Credit will be added to the group in the amount specified in the request body. The credit will be applied to group member invoices as they are generated.
IssueSubscriptionGroupServiceCredit(
ctx context.Context,
uid string,
body *models.IssueServiceCreditRequest) (
models.ApiResponse[models.ServiceCreditResponse],
error)
Parameter | Type | Tags | Description |
---|---|---|---|
uid |
string |
Template, Required | The uid of the subscription group |
body |
*models.IssueServiceCreditRequest |
Body, Optional | - |
ctx := context.Background()
uid := "uid0"
body := models.IssueServiceCreditRequest{
ServiceCredit: models.IssueServiceCredit{
Amount: models.IssueServiceCreditAmountContainer.FromPrecision(float64(10)),
Memo: models.ToPointer("Credit the group account"),
},
}
apiResponse, err := subscriptionGroupInvoiceAccountController.IssueSubscriptionGroupServiceCredit(ctx, uid, &body)
if err != nil {
log.Fatalln(err)
} else {
// Printing the result and response
fmt.Println(apiResponse.Data)
fmt.Println(apiResponse.Response.StatusCode)
}
{
"service_credit": {
"id": 101,
"amount_in_cents": 1000,
"ending_balance_in_cents": 2000,
"entry_type": "Credit",
"memo": "Credit to group account"
}
}
HTTP Status Code | Error Description | Exception Class |
---|---|---|
422 | Unprocessable Entity (WebDAV) | ErrorListResponseException |
Credit can be deducted for a subscription group identified by the group's uid
. Credit will be deducted from the group in the amount specified in the request body.
DeductSubscriptionGroupServiceCredit(
ctx context.Context,
uid string,
body *models.DeductServiceCreditRequest) (
models.ApiResponse[models.ServiceCredit],
error)
Parameter | Type | Tags | Description |
---|---|---|---|
uid |
string |
Template, Required | The uid of the subscription group |
body |
*models.DeductServiceCreditRequest |
Body, Optional | - |
ctx := context.Background()
uid := "uid0"
body := models.DeductServiceCreditRequest{
Deduction: models.DeductServiceCredit{
Amount: models.DeductServiceCreditAmountContainer.FromPrecision(float64(10)),
Memo: models.ToPointer("Deduct from group account"),
},
}
apiResponse, err := subscriptionGroupInvoiceAccountController.DeductSubscriptionGroupServiceCredit(ctx, uid, &body)
if err != nil {
log.Fatalln(err)
} else {
// Printing the result and response
fmt.Println(apiResponse.Data)
fmt.Println(apiResponse.Response.StatusCode)
}
{
"id": 100,
"amount_in_cents": 1000,
"ending_balance_in_cents": 0,
"entry_type": "Debit",
"memo": "Debit from group account"
}
HTTP Status Code | Error Description | Exception Class |
---|---|---|
422 | Unprocessable Entity (WebDAV) | ErrorListResponseException |