Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Change CustomData to map[string]string #33

Open
goenning opened this issue Oct 31, 2024 · 6 comments
Open

[Feature]: Change CustomData to map[string]string #33

goenning opened this issue Oct 31, 2024 · 6 comments

Comments

@goenning
Copy link

Tell us about your feature request

Why is CustomData a map[string]any if the value is always a string?

What problem are you looking to solve?

Changing it to map[string]string would make it easier to use

Additional context

No response

How important is this suggestion to you?

Nice to have

@davidgrayston-paddle
Copy link
Contributor

Hi @goenning 👋 Thank you for raising this issue.

The SDK currently reflects the API specification, which allows any object for custom_data (API Spec):

custom_data:
  title: Custom data
  type: object

If at any point in future this changes in the API, it would be reflected in the SDK.

@goenning
Copy link
Author

how do I set custom_data values as numbers?

@davidgrayston-paddle
Copy link
Contributor

In Go, the custom data could be created as follows:

paddle.CustomData{
	"key1": "string value",
	"key2": 1,
	"key3": 1.2,
}

The resulting JSON object would look like this:

{
    "key1": "string value",
    "key2": 1,
    "key3": 1.2
}

@goenning
Copy link
Author

My use case is that I have defined custom data on a “Product” via Paddle.com, and it seems like via the UI only strings are supported?

@goenning
Copy link
Author

When I get the webhook requests, the custom data values are always Strings

@davidgrayston-paddle
Copy link
Contributor

Hi @goenning 👋

The paddle.com dashboard currently only supports creation/update of custom data with string values. However, nested custom data (with different value types) can be created via the API (using SDK), which is currently readonly in the dashboard. The dashboard will support nested custom data in future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants