POST
/
v1
/
benefits
package main

import(
	"context"
	"os"
	polargo "github.com/polarsource/polar-go"
	"github.com/polarsource/polar-go/models/components"
	"log"
)

func main() {
    ctx := context.Background()
    
    s := polargo.New(
        polargo.WithSecurity(os.Getenv("POLAR_ACCESS_TOKEN")),
    )

    res, err := s.Benefits.Create(ctx, components.CreateBenefitCreateDownloadables(
        components.BenefitDownloadablesCreate{
            Description: "yuck forager beneath please shadowy foodstuffs welcome",
            Properties: components.BenefitDownloadablesCreateProperties{
                Files: []string{
                    "<value>",
                },
            },
        },
    ))
    if err != nil {
        log.Fatal(err)
    }
    if res.Benefit != nil {
        // handle response
    }
}
{
  "created_at": "2023-11-07T05:31:56Z",
  "modified_at": "2023-11-07T05:31:56Z",
  "id": "<string>",
  "type": "<string>",
  "description": "<string>",
  "selectable": true,
  "deletable": true,
  "organization_id": "<string>",
  "properties": {
    "image_height": 400,
    "image_width": 400
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Schema to create a benefit of type custom.

type
string
required
Allowed value: "custom"
description
string
required

The description of the benefit. Will be displayed on products having this benefit.

Required string length: 3 - 42
properties
object
required

Properties for creating a benefit of type custom.

organization_id
string | null

The ID of the organization owning the benefit. Required unless you use an organization token.

Response

201
application/json
Benefit created.

A benefit of type ads.

Use it so your backers can display ads on your README, website, etc.

created_at
string
required

Creation timestamp of the object.

modified_at
string | null
required

Last modification timestamp of the object.

id
string
required

The ID of the benefit.

type
string
required
Allowed value: "ads"
description
string
required

The description of the benefit.

selectable
boolean
required

Whether the benefit is selectable when creating a product.

deletable
boolean
required

Whether the benefit is deletable.

organization_id
string
required

The ID of the organization owning the benefit.

properties
object
required

Properties for a benefit of type ads.