ripllo

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 15 Imported by: 0

README

ripllo (Go)

Official Go SDK for Ripllo — discounts, referrals, abandoned cart, pixels, feeds, blog, creator marketplace, marketing tools (channels, contacts, contact-lists, campaigns, funnels, inbox, segments), insights, partner admin.

Mirrors @forjio/ripllo-node 0.2.2 and ripllo (PyPI) 0.1.x at the API-surface level.

Install

go get github.com/hachimi-cat/ripllo-go

Auth

Pattern 2 HMAC partner-billing — same scheme storlaunch + fulkruma use. Set credentials via env or pass them to NewClient:

RIPLLO_KEY_ID=AKIARPLO...
RIPLLO_SECRET=...
RIPLLO_BASE_URL=https://ripllo.com   # optional override
import (
    "context"
    ripllo "github.com/hachimi-cat/ripllo-go"
)

func main() {
    rip, err := ripllo.NewClient(ripllo.ClientOptions{})
    if err != nil { panic(err) }

    // Platform-admin keys can act on behalf of a merchant:
    scoped := rip.ForMerchant("acc_storlaunch_merchant_123")

    page, err := scoped.DiscountCodes.List(context.Background(), ripllo.DiscountCodesListParams{
        Limit: ripllo.IntPtr(20),
    })
    if err != nil { /* *ripllo.Error */ }
    _ = page
}

Webhook verification

import (
    "io"
    "net/http"
    "os"

    ripllo "github.com/hachimi-cat/ripllo-go"
)

func handler(w http.ResponseWriter, r *http.Request) {
    body, _ := io.ReadAll(r.Body)
    ev, err := ripllo.VerifyWebhook(
        body,
        r.Header.Get("Ripllo-Signature"),
        os.Getenv("RIPLLO_WEBHOOK_SECRET"),
        nil,
    )
    if err != nil {
        http.Error(w, "bad signature", 400)
        return
    }
    _ = ev // ev.Type, ev.Data (json.RawMessage), ev.AccountID
    w.WriteHeader(204)
}

Notes

  • Path-without-querystring signing: the SDK signs the path portion only (matches Node 0.2.x + Python 0.1.x bug fix; mismatch on ?limit= etc. was the original incident).
  • Stdlib only — no third-party dependencies.
  • Passthrough for partners that need to relay arbitrary merchant-portal requests without hand-typed methods.
  • Untyped marketing routes return the alias JSON (= map[string]any) — same shape as the Node SDK's Record<string, unknown> returns.

License

MIT

Documentation

Overview

Package ripllo is the official Go SDK for Ripllo.

It mirrors the developer-facing surface of `@forjio/ripllo-node` 0.2.2 and `ripllo` (PyPI) 0.1.x: HMAC-SHA256 partner-billing auth (Pattern 2), resource namespaces for every route group, generic `Passthrough` for partners that need to relay arbitrary merchant-portal requests, and inbound webhook verification.

Auth scheme

Authorization: Ripllo-HMAC-SHA256 keyId=<keyId>, scope=*, signature=<hex>
X-Ripllo-Timestamp: <unix_seconds>

where

signature = HMAC-SHA256(secret, "{METHOD}\n{PATH}\n{TIMESTAMP}\n{BODY_SHA256}")

with an optional trailing "\n<idempotencyKey>" segment when the request carries an Idempotency-Key header.

IMPORTANT: the path is signed WITHOUT the query string. The backend verifier strips the query before reconstructing the string-to-sign; signing the full path causes a mismatch on every request that carries query params (`?limit=`, `?status=`, etc.). This is the same fix as Node SDK 0.2.x and Python SDK 0.1.x.

Index

Constants

View Source
const (
	MarketingCampaignGoalAwareness  MarketingCampaignGoal = "awareness"
	MarketingCampaignGoalConversion MarketingCampaignGoal = "conversion"
	MarketingCampaignGoalRetention  MarketingCampaignGoal = "retention"
	MarketingCampaignGoalLaunch     MarketingCampaignGoal = "launch"
	MarketingCampaignGoalOther      MarketingCampaignGoal = "other"

	MarketingCampaignStatusDraft     MarketingCampaignStatus = "draft"
	MarketingCampaignStatusLive      MarketingCampaignStatus = "live"
	MarketingCampaignStatusPaused    MarketingCampaignStatus = "paused"
	MarketingCampaignStatusCompleted MarketingCampaignStatus = "completed"
	MarketingCampaignStatusArchived  MarketingCampaignStatus = "archived"
)
View Source
const (
	DiscountTypePercent         DiscountType = "percent"
	DiscountTypeFixed           DiscountType = "fixed"
	DiscountTypeShippingPercent DiscountType = "shipping_percent"
	DiscountTypeShippingFixed   DiscountType = "shipping_fixed"

	DiscountScopeCart     DiscountScope = "cart"
	DiscountScopeProducts DiscountScope = "products"
	DiscountScopeTags     DiscountScope = "tags"
)
View Source
const DefaultBaseURL = "https://ripllo.com"

DefaultBaseURL is the production Ripllo API base.

Variables

This section is empty.

Functions

func BoolPtr

func BoolPtr(b bool) *bool

func Float64Ptr

func Float64Ptr(f float64) *float64

func IntPtr

func IntPtr(i int) *int

func StrPtr

func StrPtr(s string) *string

Pretty pointer helpers for callers building input structs.

Types

type APIKeyCreateInput

type APIKeyCreateInput struct {
	Description *string `json:"description,omitempty"`
	Scope       *string `json:"scope,omitempty"`
}

type APIKeysResource

type APIKeysResource struct {
	// contains filtered or unexported fields
}

func (*APIKeysResource) Create

func (r *APIKeysResource) Create(ctx context.Context, input APIKeyCreateInput) (JSON, error)

func (*APIKeysResource) List

func (r *APIKeysResource) List(ctx context.Context) (JSON, error)

func (*APIKeysResource) Revoke

func (r *APIKeysResource) Revoke(ctx context.Context, id string) (*RevokedResult, error)

type AbandonedCartConfig

type AbandonedCartConfig struct {
	ID             string  `json:"id,omitempty"`
	AccountID      string  `json:"accountId,omitempty"`
	Enabled        bool    `json:"enabled"`
	DelayHours     int     `json:"delayHours"`
	EmailSubject   string  `json:"emailSubject"`
	EmailPreview   string  `json:"emailPreview"`
	DiscountCodeID *string `json:"discountCodeId"`
}

type AbandonedCartReminder

type AbandonedCartReminder struct {
	ID                   string          `json:"id"`
	AccountID            string          `json:"accountId"`
	CustomerID           string          `json:"customerId"`
	CartID               string          `json:"cartId"`
	Email                string          `json:"email"`
	CartSnapshot         json.RawMessage `json:"cartSnapshot"`
	ValueAtSend          float64         `json:"valueAtSend"`
	CurrencyAtSend       string          `json:"currencyAtSend"`
	DiscountCodeID       *string         `json:"discountCodeId"`
	ExternalSource       *string         `json:"externalSource"`
	ExternalRef          *string         `json:"externalRef"`
	SentAt               string          `json:"sentAt"`
	RecoveredAt          *string         `json:"recoveredAt"`
	RecoveredBySessionID *string         `json:"recoveredBySessionId"`
}

type AbandonedCartResource

type AbandonedCartResource struct {
	// contains filtered or unexported fields
}

func (*AbandonedCartResource) GetConfig

func (*AbandonedCartResource) ListReminders

func (*AbandonedCartResource) MarkRecovered

func (*AbandonedCartResource) RecordReminder

func (*AbandonedCartResource) Stats

func (*AbandonedCartResource) UpdateConfig

type AdminResource

type AdminResource struct {
	// contains filtered or unexported fields
}

func (*AdminResource) ApproveKYC

func (r *AdminResource) ApproveKYC(ctx context.Context, id string) (JSON, error)

func (*AdminResource) GetWorkspace

func (r *AdminResource) GetWorkspace(ctx context.Context, accountID string) (*PartnerWorkspace, error)

func (*AdminResource) ListDisputes

func (r *AdminResource) ListDisputes(ctx context.Context, p DisputesListParams) (JSON, error)

func (*AdminResource) ListKYC

func (r *AdminResource) ListKYC(ctx context.Context, p KYCListParams) (JSON, error)

func (*AdminResource) PartnerUsage

func (*AdminResource) ProvisionWorkspace

func (r *AdminResource) ProvisionWorkspace(ctx context.Context, input ProvisionWorkspaceInput) (*PartnerWorkspace, error)

func (*AdminResource) RejectKYC

func (r *AdminResource) RejectKYC(ctx context.Context, id, reason string) (JSON, error)

func (*AdminResource) ResolveDispute

func (r *AdminResource) ResolveDispute(ctx context.Context, id string, input DisputeResolution) (JSON, error)

type AffiliatesListParams

type AffiliatesListParams struct {
	Limit  *int
	Cursor *string
}

type AffiliatesResource

type AffiliatesResource struct {
	// contains filtered or unexported fields
}

func (*AffiliatesResource) List

type AffiliatorProfileResource

type AffiliatorProfileResource struct {
	// contains filtered or unexported fields
}

func (*AffiliatorProfileResource) Create

func (r *AffiliatorProfileResource) Create(ctx context.Context, input JSON) (JSON, error)

func (*AffiliatorProfileResource) Me

func (*AffiliatorProfileResource) UpdateMe

func (r *AffiliatorProfileResource) UpdateMe(ctx context.Context, patch JSON) (JSON, error)

type ApplicableListWrap

type ApplicableListWrap struct {
	Items []PublicApplicableCode `json:"items"`
}

type ApplicableParams

type ApplicableParams struct {
	Currency  *string
	ProductID *string
	Tags      *string
	Subtotal  *float64
}

type ArchiveResult

type ArchiveResult struct {
	ID     string `json:"id"`
	Active bool   `json:"active"`
}

type AttributeCheckoutStartInput

type AttributeCheckoutStartInput struct {
	AccountID         string `json:"accountId"`
	CustomerID        string `json:"customerId"`
	CheckoutSessionID string `json:"checkoutSessionId"`
}

type AttributeCheckoutStartResult

type AttributeCheckoutStartResult struct {
	Stamped       bool   `json:"stamped"`
	AttributionID string `json:"attributionId,omitempty"`
}

type AttributeSignupInput

type AttributeSignupInput struct {
	AccountID         string  `json:"accountId"`
	RefereeCustomerID string  `json:"refereeCustomerId"`
	RefereeEmail      string  `json:"refereeEmail"`
	ReferrerEmail     *string `json:"referrerEmail,omitempty"`
	LinkCode          string  `json:"linkCode"`
	ExternalSource    *string `json:"externalSource,omitempty"`
	ExternalRef       *string `json:"externalRef,omitempty"`
}

type AttributeSignupResult

type AttributeSignupResult struct {
	Attribution *ReferralAttribution `json:"attribution"`
}

type AudienceSegmentsResource

type AudienceSegmentsResource struct {
	// contains filtered or unexported fields
}

func (*AudienceSegmentsResource) Create

func (r *AudienceSegmentsResource) Create(ctx context.Context, input JSON) (JSON, error)

func (*AudienceSegmentsResource) Delete

func (*AudienceSegmentsResource) Get

func (*AudienceSegmentsResource) List

func (*AudienceSegmentsResource) Preview

func (r *AudienceSegmentsResource) Preview(ctx context.Context, id string, input JSON) (JSON, error)

func (*AudienceSegmentsResource) PreviewAdhoc

func (r *AudienceSegmentsResource) PreviewAdhoc(ctx context.Context, input JSON) (JSON, error)

func (*AudienceSegmentsResource) Update

func (r *AudienceSegmentsResource) Update(ctx context.Context, id string, patch JSON) (JSON, error)

type AuditListParams

type AuditListParams struct {
	Limit     *int
	Cursor    *string
	Since     *string
	EventType *string
}

type AuditLogResource

type AuditLogResource struct {
	// contains filtered or unexported fields
}

func (*AuditLogResource) List

type BillingResource

type BillingResource struct {
	// contains filtered or unexported fields
}

func (*BillingResource) Cancel

func (r *BillingResource) Cancel(ctx context.Context) (JSON, error)

func (*BillingResource) Checkout

func (r *BillingResource) Checkout(ctx context.Context, input CheckoutInput) (*CheckoutResult, error)

func (*BillingResource) CurrentPlan

func (r *BillingResource) CurrentPlan(ctx context.Context) (JSON, error)

func (*BillingResource) Invoices

func (*BillingResource) Plans

func (r *BillingResource) Plans(ctx context.Context) ([]JSON, error)

func (*BillingResource) Subscription

func (r *BillingResource) Subscription(ctx context.Context) (JSON, error)

func (*BillingResource) Usage

func (r *BillingResource) Usage(ctx context.Context) (JSON, error)

type BlogListParams

type BlogListParams struct {
	Status *BlogPostStatus
}

type BlogPost

type BlogPost struct {
	ID              string         `json:"id"`
	AccountID       string         `json:"accountId"`
	Slug            string         `json:"slug"`
	Title           string         `json:"title"`
	Excerpt         *string        `json:"excerpt"`
	Body            string         `json:"body"`
	CoverImage      *string        `json:"coverImage"`
	Status          BlogPostStatus `json:"status"`
	PublishedAt     *string        `json:"publishedAt"`
	AuthorName      *string        `json:"authorName"`
	Tags            []string       `json:"tags"`
	MetaTitle       *string        `json:"metaTitle"`
	MetaDescription *string        `json:"metaDescription"`
	CreatedAt       string         `json:"createdAt"`
	UpdatedAt       string         `json:"updatedAt"`
}

type BlogPostInput

type BlogPostInput struct {
	Slug            string          `json:"slug"`
	Title           string          `json:"title"`
	Excerpt         *string         `json:"excerpt,omitempty"`
	Body            string          `json:"body"`
	CoverImage      *string         `json:"coverImage,omitempty"`
	Status          *BlogPostStatus `json:"status,omitempty"`
	PublishedAt     *string         `json:"publishedAt,omitempty"`
	AuthorName      *string         `json:"authorName,omitempty"`
	Tags            []string        `json:"tags,omitempty"`
	MetaTitle       *string         `json:"metaTitle,omitempty"`
	MetaDescription *string         `json:"metaDescription,omitempty"`
}

type BlogPostListWrap

type BlogPostListWrap struct {
	Posts []BlogPost `json:"posts"`
}

type BlogPostStatus

type BlogPostStatus string

BlogPostStatus — `draft` | `published`.

const (
	BlogPostStatusDraft     BlogPostStatus = "draft"
	BlogPostStatusPublished BlogPostStatus = "published"
)

func StatusPtr

func StatusPtr(s BlogPostStatus) *BlogPostStatus

type BlogPostWrap

type BlogPostWrap struct {
	Post BlogPost `json:"post"`
}

type BlogResource

type BlogResource struct {
	// contains filtered or unexported fields
}

func (*BlogResource) Create

func (r *BlogResource) Create(ctx context.Context, input BlogPostInput) (*BlogPostWrap, error)

func (*BlogResource) Delete

func (r *BlogResource) Delete(ctx context.Context, id string) (*DeletedResult, error)

func (*BlogResource) Get

func (r *BlogResource) Get(ctx context.Context, id string) (*BlogPostWrap, error)

func (*BlogResource) List

func (*BlogResource) PublicGet

func (r *BlogResource) PublicGet(ctx context.Context, accountID, slug string) (*BlogPostWrap, error)

func (*BlogResource) PublicList

func (r *BlogResource) PublicList(ctx context.Context, accountID string) (*BlogPostListWrap, error)

PublicList returns a slimmed list shape (no body). Decoded as generic BlogPostListWrap — the Node SDK's Pick<> shape just hides fields, the JSON is still valid against BlogPost.

func (*BlogResource) Update

func (r *BlogResource) Update(ctx context.Context, id string, patch BlogPostInput) (*BlogPostWrap, error)

type BroadcastsResource

type BroadcastsResource struct {
	// contains filtered or unexported fields
}

func (*BroadcastsResource) CompileTemplate

func (r *BroadcastsResource) CompileTemplate(ctx context.Context, input JSON) (*CompileTemplateResult, error)

func (*BroadcastsResource) Create

func (r *BroadcastsResource) Create(ctx context.Context, input JSON) (JSON, error)

func (*BroadcastsResource) CreateTemplate

func (r *BroadcastsResource) CreateTemplate(ctx context.Context, input JSON) (JSON, error)

func (*BroadcastsResource) Get

func (r *BroadcastsResource) Get(ctx context.Context, id string) (JSON, error)

func (*BroadcastsResource) List

func (r *BroadcastsResource) List(ctx context.Context) ([]JSON, error)

func (*BroadcastsResource) ListTemplates

func (r *BroadcastsResource) ListTemplates(ctx context.Context) (JSON, error)

func (*BroadcastsResource) Send

func (r *BroadcastsResource) Send(ctx context.Context, id string, input JSON) (JSON, error)

func (*BroadcastsResource) SendTest

func (r *BroadcastsResource) SendTest(ctx context.Context, id, to string) (JSON, error)

func (*BroadcastsResource) Update

func (r *BroadcastsResource) Update(ctx context.Context, id string, patch JSON) (JSON, error)

func (*BroadcastsResource) UpdateTemplate

func (r *BroadcastsResource) UpdateTemplate(ctx context.Context, templateID string, patch JSON) (JSON, error)

type CampaignsResource

type CampaignsResource struct {
	// contains filtered or unexported fields
}

func (*CampaignsResource) AcceptApplication

func (r *CampaignsResource) AcceptApplication(ctx context.Context, id, applicationID string) (JSON, error)

func (*CampaignsResource) Analytics

func (r *CampaignsResource) Analytics(ctx context.Context, id string) (JSON, error)

func (*CampaignsResource) Create

func (r *CampaignsResource) Create(ctx context.Context, input JSON) (JSON, error)

func (*CampaignsResource) Get

func (r *CampaignsResource) Get(ctx context.Context, id string) (JSON, error)

func (*CampaignsResource) InviteCreator

func (r *CampaignsResource) InviteCreator(ctx context.Context, id, creatorID string) (JSON, error)

func (*CampaignsResource) List

func (r *CampaignsResource) List(ctx context.Context) (JSON, error)

func (*CampaignsResource) ListApplications

func (r *CampaignsResource) ListApplications(ctx context.Context, id string) (JSON, error)

func (*CampaignsResource) RejectApplication

func (r *CampaignsResource) RejectApplication(ctx context.Context, id, applicationID string) (JSON, error)

func (*CampaignsResource) Update

func (r *CampaignsResource) Update(ctx context.Context, id string, patch JSON) (JSON, error)

type ChannelsResource

type ChannelsResource struct {
	// contains filtered or unexported fields
}

func (*ChannelsResource) Create

func (r *ChannelsResource) Create(ctx context.Context, input JSON) (JSON, error)

func (*ChannelsResource) DNS

func (r *ChannelsResource) DNS(ctx context.Context, id string) (JSON, error)

Short alias (v0.2.1).

func (*ChannelsResource) DNSRecords

func (r *ChannelsResource) DNSRecords(ctx context.Context, id string) (JSON, error)

func (*ChannelsResource) Delete

func (r *ChannelsResource) Delete(ctx context.Context, id string) (*DeletedResult, error)

func (*ChannelsResource) Get

func (r *ChannelsResource) Get(ctx context.Context, id string) (JSON, error)

func (*ChannelsResource) List

func (r *ChannelsResource) List(ctx context.Context) (JSON, error)

func (*ChannelsResource) OAuthStart

func (r *ChannelsResource) OAuthStart(ctx context.Context, provider string) (JSON, error)

func (*ChannelsResource) Test

func (r *ChannelsResource) Test(ctx context.Context, id string) (JSON, error)

func (*ChannelsResource) Update

func (r *ChannelsResource) Update(ctx context.Context, id string, patch JSON) (JSON, error)

type CheckoutInput

type CheckoutInput struct {
	PlanID     string `json:"planId"`
	SuccessURL string `json:"successUrl,omitempty"`
	CancelURL  string `json:"cancelUrl,omitempty"`
}

type CheckoutResult

type CheckoutResult struct {
	URL       string `json:"url"`
	SessionID string `json:"sessionId"`
}

type Client

type Client struct {

	// Resource namespaces — every API surface is grouped here, matching
	// the Node SDK's nested object shape.
	DiscountCodes  *DiscountCodesResource
	Pixels         *PixelsResource
	Feeds          *FeedsResource
	Blog           *BlogResource
	AbandonedCart  *AbandonedCartResource
	Referrals      *ReferralsResource
	APIKeys        *APIKeysResource
	Webhooks       *WebhooksResource
	AuditLog       *AuditLogResource
	Integrations   *IntegrationsResource
	Billing        *BillingResource
	Uploads        *UploadsResource
	Campaigns      *CampaignsResource
	Programs       *ProgramsResource
	Collaborations *CollaborationsResource
	Insights       *InsightsResource
	Channels       *ChannelsResource
	Contacts       *ContactsResource
	ContactLists   *ContactListsResource
	Broadcasts     *BroadcastsResource
	// MarketingCampaigns is the top-level marketing-campaign hub
	// (/api/v1/marketing-campaigns). It is now a SEPARATE resource
	// from Broadcasts — pre-v0.5 it was a deprecated alias of
	// Broadcasts (when /api/v1/marketing-campaigns served email
	// blasts). The hub took over that URL in PR #11; the alias was
	// removed in PR #13.
	MarketingCampaigns *MarketingCampaignsResource
	Funnels            *FunnelsResource
	Inbox              *InboxResource
	AudienceSegments   *AudienceSegmentsResource
	MerchantProfile    *MerchantProfileResource
	CreatorProfile     *CreatorProfileResource
	AffiliatorProfile  *AffiliatorProfileResource
	Marketplace        *MarketplaceResource
	Affiliates         *AffiliatesResource
	KYC                *KYCResource
	CreatorStats       *CreatorStatsResource
	Admin              *AdminResource
	// contains filtered or unexported fields
}

Client is the high-level SDK surface. Construct via NewClient.

Concurrency-safe: every method is safe for use from multiple goroutines. ForMerchant returns a shallow clone that shares the underlying *http.Client.

func NewClient

func NewClient(opts ClientOptions) (*Client, error)

NewClient constructs a Client. KeyID + Secret are required (env fallback is checked first).

func (*Client) BaseURL

func (c *Client) BaseURL() string

BaseURL returns the configured base URL. Useful for building public-facing URLs (e.g. `feeds.GoogleFeedURL`).

func (*Client) Do

func (c *Client) Do(ctx context.Context, opts RequestOptions, out any) error

Do dispatches a signed request and decodes the `data` envelope into out. Pass out=nil to discard the response. Errors surface as *Error.

out may also be a *json.RawMessage to capture the raw `data` field without decoding.

func (*Client) ForMerchant

func (c *Client) ForMerchant(accountID string) *Client

ForMerchant returns a clone scoped to a specific merchant accountId, added as `X-Ripllo-On-Behalf-Of` on every request. Use with platform-admin keys.

func (*Client) Passthrough

func (c *Client) Passthrough(ctx context.Context, method, path string, body, out any) error

Passthrough forwards an arbitrary merchant-portal request to Ripllo and decodes the resulting envelope `data` into out. For partners (storlaunch / fulkruma) that need to relay arbitrary requests without hand-writing a typed method per resource.

type ClientOptions

type ClientOptions struct {
	KeyID      string        // defaults to RIPLLO_KEY_ID
	Secret     string        // defaults to RIPLLO_SECRET
	BaseURL    string        // defaults to RIPLLO_BASE_URL, then DefaultBaseURL
	OnBehalfOf string        // optional merchant accountId for X-Ripllo-On-Behalf-Of
	Timeout    time.Duration // per-request timeout, default 30s
	HTTP       *http.Client  // custom client; defaults to http.DefaultClient
}

ClientOptions matches the env-var defaults of the Node + Python SDKs. KeyID + Secret default to RIPLLO_KEY_ID + RIPLLO_SECRET when blank. BaseURL defaults to RIPLLO_BASE_URL, then DefaultBaseURL.

type CollaborationsResource

type CollaborationsResource struct {
	// contains filtered or unexported fields
}

func (*CollaborationsResource) Approve

func (r *CollaborationsResource) Approve(ctx context.Context, id string) (JSON, error)

Short aliases (v0.2.1).

func (*CollaborationsResource) ApproveCollaboration

func (r *CollaborationsResource) ApproveCollaboration(ctx context.Context, id string) (JSON, error)

func (*CollaborationsResource) ApproveDeliverable

func (r *CollaborationsResource) ApproveDeliverable(ctx context.Context, id, deliverableID string) (JSON, error)

func (*CollaborationsResource) Cancel

func (r *CollaborationsResource) Cancel(ctx context.Context, id string) (JSON, error)

func (*CollaborationsResource) CancelCollaboration

func (r *CollaborationsResource) CancelCollaboration(ctx context.Context, id string) (JSON, error)

func (*CollaborationsResource) FromApplication

func (r *CollaborationsResource) FromApplication(ctx context.Context, applicationID string, input JSON) (JSON, error)

func (*CollaborationsResource) Get

func (*CollaborationsResource) List

func (*CollaborationsResource) PublishDeliverable

func (r *CollaborationsResource) PublishDeliverable(ctx context.Context, id, deliverableID string) (JSON, error)

func (*CollaborationsResource) RejectDeliverable

func (r *CollaborationsResource) RejectDeliverable(ctx context.Context, id, deliverableID, reason string) (JSON, error)

func (*CollaborationsResource) UploadDeliverableKey

func (r *CollaborationsResource) UploadDeliverableKey(ctx context.Context, id, deliverableID string, input DeliverableUploadInput) (*SignResult, error)

type CommissionsListParams

type CommissionsListParams struct {
	Limit  *int
	Cursor *string
}

type CommissionsTrendParams

type CommissionsTrendParams struct {
	Days *int
}

type CompileTemplateResult

type CompileTemplateResult struct {
	HTML string `json:"html"`
}

type ContactListInput

type ContactListInput struct {
	Name        string  `json:"name"`
	Description *string `json:"description,omitempty"`
}

type ContactListsResource

type ContactListsResource struct {
	// contains filtered or unexported fields
}

func (*ContactListsResource) AddMember

func (r *ContactListsResource) AddMember(ctx context.Context, id, contactID string) (JSON, error)

func (*ContactListsResource) Create

func (*ContactListsResource) Delete

func (*ContactListsResource) Get

func (r *ContactListsResource) Get(ctx context.Context, id string) (JSON, error)

func (*ContactListsResource) List

func (r *ContactListsResource) List(ctx context.Context) (JSON, error)

func (*ContactListsResource) RemoveMember

func (r *ContactListsResource) RemoveMember(ctx context.Context, id, contactID string) (JSON, error)

type ContactsListParams

type ContactsListParams struct {
	Limit  *int
	Cursor *string
	Search *string
}

type ContactsResource

type ContactsResource struct {
	// contains filtered or unexported fields
}

func (*ContactsResource) Create

func (r *ContactsResource) Create(ctx context.Context, input JSON) (JSON, error)

func (*ContactsResource) Delete

func (r *ContactsResource) Delete(ctx context.Context, id string) (*DeletedResult, error)

func (*ContactsResource) Get

func (r *ContactsResource) Get(ctx context.Context, id string) (JSON, error)

func (*ContactsResource) Import

func (r *ContactsResource) Import(ctx context.Context, input JSON) (JSON, error)

func (*ContactsResource) List

func (*ContactsResource) Update

func (r *ContactsResource) Update(ctx context.Context, id string, patch JSON) (JSON, error)

type CreatorProfileResource

type CreatorProfileResource struct {
	// contains filtered or unexported fields
}

func (*CreatorProfileResource) Create

func (r *CreatorProfileResource) Create(ctx context.Context, input JSON) (JSON, error)

func (*CreatorProfileResource) Me

func (*CreatorProfileResource) UpdateMe

func (r *CreatorProfileResource) UpdateMe(ctx context.Context, patch JSON) (JSON, error)

type CreatorStatsResource

type CreatorStatsResource struct {
	// contains filtered or unexported fields
}

func (*CreatorStatsResource) Connect

func (r *CreatorStatsResource) Connect(ctx context.Context, provider string) (JSON, error)

func (*CreatorStatsResource) Overview

func (r *CreatorStatsResource) Overview(ctx context.Context) (JSON, error)

type DeletedResult

type DeletedResult struct {
	Deleted bool `json:"deleted"`
}

type DeliverableUploadInput

type DeliverableUploadInput struct {
	Filename    string `json:"filename"`
	ContentType string `json:"contentType"`
}

type DiscountCode

type DiscountCode struct {
	ID                 string        `json:"id"`
	AccountID          string        `json:"accountId"`
	Code               string        `json:"code"`
	Description        *string       `json:"description"`
	Type               DiscountType  `json:"type"`
	Value              float64       `json:"value"`
	Currency           string        `json:"currency"`
	Scope              DiscountScope `json:"scope"`
	ProductIDs         []string      `json:"productIds"`
	TagFilter          []string      `json:"tagFilter"`
	MinPurchaseAmount  *float64      `json:"minPurchaseAmount"`
	MaxUsesTotal       *int          `json:"maxUsesTotal"`
	MaxUsesPerCustomer *int          `json:"maxUsesPerCustomer"`
	StartsAt           *string       `json:"startsAt"`
	ExpiresAt          *string       `json:"expiresAt"`
	Active             bool          `json:"active"`
	Public             bool          `json:"public"`
	RedemptionCount    int           `json:"redemptionCount"`
	Source             *string       `json:"source"`
	SourceRefID        *string       `json:"sourceRefId"`
	CreatedAt          string        `json:"createdAt"`
	UpdatedAt          string        `json:"updatedAt"`
}

type DiscountCodeCreateInput

type DiscountCodeCreateInput struct {
	Code               string        `json:"code"`
	Description        *string       `json:"description,omitempty"`
	Type               DiscountType  `json:"type"`
	Value              float64       `json:"value"`
	Currency           string        `json:"currency"`
	Scope              DiscountScope `json:"scope,omitempty"`
	ProductIDs         []string      `json:"productIds,omitempty"`
	TagFilter          []string      `json:"tagFilter,omitempty"`
	MinPurchaseAmount  *float64      `json:"minPurchaseAmount,omitempty"`
	MaxUsesTotal       *int          `json:"maxUsesTotal,omitempty"`
	MaxUsesPerCustomer *int          `json:"maxUsesPerCustomer,omitempty"`
	StartsAt           *string       `json:"startsAt,omitempty"`
	ExpiresAt          *string       `json:"expiresAt,omitempty"`
	Active             *bool         `json:"active,omitempty"`
	Public             *bool         `json:"public,omitempty"`
}

DiscountCodeCreateInput — fields for `discountCodes.Create`. Pointer fields are optional (omitted when nil).

type DiscountCodeListPage

type DiscountCodeListPage struct {
	Items      []DiscountCode `json:"items"`
	Total      int            `json:"total"`
	NextCursor *string        `json:"nextCursor"`
	HasMore    bool           `json:"hasMore"`
}

type DiscountCodesListParams

type DiscountCodesListParams struct {
	Limit  *int
	Cursor *string
	Active *bool
}

type DiscountCodesResource

type DiscountCodesResource struct {
	// contains filtered or unexported fields
}

func (*DiscountCodesResource) Applicable

Applicable returns public applicable codes for a storefront teaser.

func (*DiscountCodesResource) Archive

func (*DiscountCodesResource) Create

func (*DiscountCodesResource) Get

func (*DiscountCodesResource) List

func (*DiscountCodesResource) Redeem

Redeem — idempotent redemption. Call from your payment-success path.

func (*DiscountCodesResource) Update

Update — patch is a partial DiscountCodeCreateInput. Use pointers to indicate which fields to send.

func (*DiscountCodesResource) Validate

Validate — read-only validation for cart preview.

type DiscountScope

type DiscountScope string

DiscountScope — `cart` | `products` | `tags`.

type DiscountType

type DiscountType string

DiscountType — `percent` | `fixed` | `shipping_percent` | `shipping_fixed`.

type DisputeResolution

type DisputeResolution struct {
	Resolution string `json:"resolution"` // "merchant" | "creator"
	Note       string `json:"note,omitempty"`
}

type DisputesListParams

type DisputesListParams struct {
	Status *string
	Limit  *int
}

type Error

type Error struct {
	Status    int
	Code      string
	Message   string
	RequestID string
}

Error is the single error type returned by every operation in this package. Mirrors the Node `RiplloError` and Python `RiplloError` shape so callers can branch on .Code without matching strings.

Status is the HTTP status code, or 0 for transport-level errors (network, timeout, non-JSON response received before the request reached the API). Code is the machine-readable error code — for server-side errors this is `envelope.error.code`; for client-side failures one of `timeout` / `network_error` / `invalid_response` / `unknown`. RequestID is the `meta.requestId` field of the envelope, when present.

func (*Error) Error

func (e *Error) Error() string

type EventsListParams

type EventsListParams struct {
	Limit  *int
	Cursor *string
	Type   *string
}

type ExpirePendingResult

type ExpirePendingResult struct {
	Expired int `json:"expired"`
}

type FeedsResource

type FeedsResource struct {
	// contains filtered or unexported fields
}

func (*FeedsResource) GetConfig

func (r *FeedsResource) GetConfig(ctx context.Context) (*MerchantFeedConfig, error)

func (*FeedsResource) GoogleFeedURL

func (r *FeedsResource) GoogleFeedURL(accountID string) string

GoogleFeedURL builds the public XML feed URL — no signing required.

func (*FeedsResource) UpdateConfig

func (r *FeedsResource) UpdateConfig(ctx context.Context, patch MerchantFeedConfig) (*MerchantFeedConfig, error)

type FulfillRewardInput

type FulfillRewardInput struct {
	CheckoutSessionID string  `json:"checkoutSessionId"`
	Status            string  `json:"status"`
	Currency          string  `json:"currency"`
	Amount            float64 `json:"amount"`
}

type FulfillRewardResult

type FulfillRewardResult struct {
	Issued         bool   `json:"issued"`
	Reason         string `json:"reason,omitempty"`
	ReferrerCodeID string `json:"referrerCodeId,omitempty"`
	RefereeCodeID  string `json:"refereeCodeId,omitempty"`
}

type FunnelsResource

type FunnelsResource struct {
	// contains filtered or unexported fields
}

func (*FunnelsResource) Analytics

func (r *FunnelsResource) Analytics(ctx context.Context, id string) (JSON, error)

func (*FunnelsResource) Create

func (r *FunnelsResource) Create(ctx context.Context, input JSON) (JSON, error)

func (*FunnelsResource) Delete

func (r *FunnelsResource) Delete(ctx context.Context, id string) (*DeletedResult, error)

func (*FunnelsResource) Enroll

func (r *FunnelsResource) Enroll(ctx context.Context, id string, input JSON) (JSON, error)

func (*FunnelsResource) Get

func (r *FunnelsResource) Get(ctx context.Context, id string) (JSON, error)

func (*FunnelsResource) List

func (r *FunnelsResource) List(ctx context.Context) (JSON, error)

func (*FunnelsResource) ListEnrollments

func (r *FunnelsResource) ListEnrollments(ctx context.Context, id string) (JSON, error)

func (*FunnelsResource) SetSteps

func (r *FunnelsResource) SetSteps(ctx context.Context, id string, input any) (JSON, error)

SetSteps accepts either a `[]any` (treated as `steps`) or a JSON map. Mirrors the Node SDK shape: when callers pass a bare array, the SDK wraps it in `{steps: [...]}` automatically.

func (*FunnelsResource) Update

func (r *FunnelsResource) Update(ctx context.Context, id string, patch JSON) (JSON, error)

type InboxResource

type InboxResource struct {
	// contains filtered or unexported fields
}

func (*InboxResource) Archive

func (r *InboxResource) Archive(ctx context.Context, threadID string) (JSON, error)

func (*InboxResource) GetThread

func (r *InboxResource) GetThread(ctx context.Context, provider, handle string) (JSON, error)

func (*InboxResource) ListThreads

func (r *InboxResource) ListThreads(ctx context.Context, p InboxThreadsListParams) (JSON, error)

func (*InboxResource) MarkRead

func (r *InboxResource) MarkRead(ctx context.Context, threadID string) (JSON, error)

type InboxThreadsListParams

type InboxThreadsListParams struct {
	Limit  *int
	Cursor *string
}

type InsightsResource

type InsightsResource struct {
	// contains filtered or unexported fields
}

func (*InsightsResource) CampaignDetail

func (r *InsightsResource) CampaignDetail(ctx context.Context, id string) (JSON, error)

func (*InsightsResource) CommissionsTrend

func (r *InsightsResource) CommissionsTrend(ctx context.Context, p CommissionsTrendParams) (JSON, error)

func (*InsightsResource) Overview

func (r *InsightsResource) Overview(ctx context.Context) (JSON, error)

func (*InsightsResource) ProgramDetail

func (r *InsightsResource) ProgramDetail(ctx context.Context, id string) (JSON, error)

type IntegrationsResource

type IntegrationsResource struct {
	// contains filtered or unexported fields
}

func (*IntegrationsResource) GetEmail

func (r *IntegrationsResource) GetEmail(ctx context.Context) (JSON, error)

func (*IntegrationsResource) Status

func (r *IntegrationsResource) Status(ctx context.Context) (JSON, error)

func (*IntegrationsResource) UpdateEmail

func (r *IntegrationsResource) UpdateEmail(ctx context.Context, input JSON) (JSON, error)

type InvoicesListParams

type InvoicesListParams struct {
	Limit  *int
	Cursor *string
}

type IssueLinkInput

type IssueLinkInput struct {
	AccountID  string `json:"accountId"`
	CustomerID string `json:"customerId"`
}

type IssueLinkResult

type IssueLinkResult struct {
	Link *ReferralLink `json:"link"`
}

type JSON

type JSON = map[string]any

JSON is the generic untyped response shape used by the resource methods that don't have a fully-modeled struct yet (most marketing routes). It's a thin alias for map[string]any so callers can decode once and JSON.Unmarshal into a stricter type if they want.

func AsJSON

func AsJSON(v any) (JSON, error)

AsJSON is a small convenience for callers that already have a typed struct but want it as `JSON` (e.g. for passing into the marketing resources). Returns a freshly allocated map.

type KYCListParams

type KYCListParams struct {
	Status *string
	Limit  *int
}

type KYCResource

type KYCResource struct {
	// contains filtered or unexported fields
}

func (*KYCResource) GetStatus

func (r *KYCResource) GetStatus(ctx context.Context) (JSON, error)

func (*KYCResource) Submit

func (r *KYCResource) Submit(ctx context.Context, input JSON) (JSON, error)

type MarkRecoveredInput

type MarkRecoveredInput struct {
	AccountID         string  `json:"accountId"`
	CustomerID        string  `json:"customerId"`
	CheckoutSessionID string  `json:"checkoutSessionId"`
	CompletedAt       *string `json:"completedAt,omitempty"`
}

type MarkRecoveredResult

type MarkRecoveredResult struct {
	Recovered  bool   `json:"recovered"`
	ReminderID string `json:"reminderId,omitempty"`
}

type MarketingCampaignCreateInput

type MarketingCampaignCreateInput struct {
	Name        string                  `json:"name"`
	Description *string                 `json:"description,omitempty"`
	Goal        MarketingCampaignGoal   `json:"goal,omitempty"`
	Status      MarketingCampaignStatus `json:"status,omitempty"`
	BudgetIDR   *int64                  `json:"budgetIdr,omitempty"`
	StartsAt    *string                 `json:"startsAt,omitempty"`
	EndsAt      *string                 `json:"endsAt,omitempty"`
	Notes       *string                 `json:"notes,omitempty"`
}

MarketingCampaignCreateInput — payload for POST /marketing-campaigns.

`omitempty` on optional fields keeps wire payloads small; the pointer-typed fields are NULL-allowing so callers can explicitly clear server-side values.

type MarketingCampaignGoal

type MarketingCampaignGoal string

MarketingCampaignGoal — `awareness` | `conversion` | `retention` | `launch` | `other`.

type MarketingCampaignStatus

type MarketingCampaignStatus string

MarketingCampaignStatus — `draft` | `live` | `paused` | `completed` | `archived`.

type MarketingCampaignUpdateInput

type MarketingCampaignUpdateInput = MarketingCampaignCreateInput

type MarketingCampaignsListParams

type MarketingCampaignsListParams struct {
	Status []MarketingCampaignStatus
	Limit  *int
	Cursor *string
}

MarketingCampaignsListParams — narrow filters for List.

Status is comma-joined when sent; a single string is also accepted verbatim. Limit / Cursor mirror the standard Ripllo paging shape; the backend isn't paged yet but the fields are passed through for forward-compat.

type MarketingCampaignsResource

type MarketingCampaignsResource struct {
	// contains filtered or unexported fields
}

func (*MarketingCampaignsResource) Create

func (*MarketingCampaignsResource) Delete

Delete — soft-delete via status='archived' on the server.

func (*MarketingCampaignsResource) Get

func (*MarketingCampaignsResource) GetFull

func (r *MarketingCampaignsResource) GetFull(ctx context.Context, id string) (JSON, error)

GetFull — GET /:id/full — hub + all linked children + perf roll-up.

func (*MarketingCampaignsResource) List

func (*MarketingCampaignsResource) Selector

func (r *MarketingCampaignsResource) Selector(ctx context.Context) (JSON, error)

Selector — GET /_/selector — lightweight dropdown payload (non-archived).

func (*MarketingCampaignsResource) Update

type MarketplaceResource

type MarketplaceResource struct {
	// contains filtered or unexported fields
}

func (*MarketplaceResource) ApplyToCampaign

func (r *MarketplaceResource) ApplyToCampaign(ctx context.Context, id string, input JSON) (JSON, error)

func (*MarketplaceResource) GetCampaign

func (r *MarketplaceResource) GetCampaign(ctx context.Context, id string) (JSON, error)

func (*MarketplaceResource) GetCreator

func (r *MarketplaceResource) GetCreator(ctx context.Context, handle string) (JSON, error)

func (*MarketplaceResource) ListCampaigns

func (r *MarketplaceResource) ListCampaigns(ctx context.Context, params JSON) (JSON, error)

func (*MarketplaceResource) ListCreators

func (r *MarketplaceResource) ListCreators(ctx context.Context, params JSON) (JSON, error)

func (*MarketplaceResource) MyApplications

func (r *MarketplaceResource) MyApplications(ctx context.Context) (JSON, error)

func (*MarketplaceResource) MyInvitations

func (r *MarketplaceResource) MyInvitations(ctx context.Context) (JSON, error)

func (*MarketplaceResource) RespondToInvitation

func (r *MarketplaceResource) RespondToInvitation(ctx context.Context, invitationID string, accept bool) (JSON, error)

type MerchantFeedConfig

type MerchantFeedConfig struct {
	Enabled                      bool    `json:"enabled"`
	DefaultGoogleProductCategory *string `json:"defaultGoogleProductCategory"`
	IncludeUnpublished           bool    `json:"includeUnpublished"`
}

type MerchantPixels

type MerchantPixels struct {
	ID                     string  `json:"id,omitempty"`
	AccountID              string  `json:"accountId,omitempty"`
	MetaPixelID            *string `json:"metaPixelId"`
	MetaCapiAccessToken    *string `json:"metaCapiAccessToken,omitempty"`
	MetaTestEventCode      *string `json:"metaTestEventCode,omitempty"`
	GoogleAnalyticsID      *string `json:"googleAnalyticsId"`
	GoogleAdsConversionID  *string `json:"googleAdsConversionId"`
	GoogleAdsPurchaseLabel *string `json:"googleAdsPurchaseLabel"`
	TiktokPixelID          *string `json:"tiktokPixelId"`
	Enabled                bool    `json:"enabled"`
}

type MerchantProfileResource

type MerchantProfileResource struct {
	// contains filtered or unexported fields
}

func (*MerchantProfileResource) GetBySlug

func (r *MerchantProfileResource) GetBySlug(ctx context.Context, slug string) (JSON, error)

func (*MerchantProfileResource) List

func (*MerchantProfileResource) Me

func (*MerchantProfileResource) Publish

func (r *MerchantProfileResource) Publish(ctx context.Context) (JSON, error)

func (*MerchantProfileResource) Unpublish

func (r *MerchantProfileResource) Unpublish(ctx context.Context) (JSON, error)

func (*MerchantProfileResource) UpdateMe

func (r *MerchantProfileResource) UpdateMe(ctx context.Context, patch JSON) (JSON, error)

type MyReward

type MyReward struct {
	Role          string       `json:"role"` // "referrer" | "referee"
	AttributionID string       `json:"attributionId"`
	Code          string       `json:"code"`
	DiscountType  DiscountType `json:"discountType"`
	Value         float64      `json:"value"`
	Currency      string       `json:"currency"`
	ExpiresAt     *string      `json:"expiresAt"`
	Redeemed      bool         `json:"redeemed"`
	Active        bool         `json:"active"`
	EarnedAt      string       `json:"earnedAt"`
}

type MyRewardsListWrap

type MyRewardsListWrap struct {
	Items []MyReward `json:"items"`
}

type PartnerUsageQuery

type PartnerUsageQuery struct {
	Partner string `query:"partner"`
	From    string `query:"from"`
	To      string `query:"to"`
}

type PartnerUsageSummary

type PartnerUsageSummary struct {
	Partner string `json:"partner"`
	Period  struct {
		From string `json:"from"`
		To   string `json:"to"`
	} `json:"period"`
	Totals struct {
		Redemptions     int `json:"redemptions"`
		ReferralRewards int `json:"referralRewards"`
		Reminders       int `json:"reminders"`
		ChargeableCents int `json:"chargeableCents"`
	} `json:"totals"`
	ByMerchant []struct {
		AccountID       string `json:"accountId"`
		Redemptions     int    `json:"redemptions"`
		ReferralRewards int    `json:"referralRewards"`
		Reminders       int    `json:"reminders"`
		ChargeableCents int    `json:"chargeableCents"`
	} `json:"byMerchant"`
}

type PartnerWorkspace

type PartnerWorkspace struct {
	AccountID     string  `json:"accountId"`
	Partner       string  `json:"partner"`
	DiscountRate  float64 `json:"discountRate"`
	BrandName     *string `json:"brandName"`
	BusinessEmail *string `json:"businessEmail"`
	CreatedAt     string  `json:"createdAt"`
}

type PixelsResource

type PixelsResource struct {
	// contains filtered or unexported fields
}

func (*PixelsResource) Get

func (*PixelsResource) Public

func (r *PixelsResource) Public(ctx context.Context, accountID string) (*PublicPixels, error)

Public — storefront-public read, never returns CAPI secret.

func (*PixelsResource) Update

type ProgramStats

type ProgramStats struct {
	TotalLinks        int     `json:"totalLinks"`
	TotalClicks       int     `json:"totalClicks"`
	TotalSignups      int     `json:"totalSignups"`
	TotalRewards      int     `json:"totalRewards"`
	AttributedRevenue float64 `json:"attributedRevenue"`
	ConversionRate    float64 `json:"conversionRate"`
}

type ProgramsResource

type ProgramsResource struct {
	// contains filtered or unexported fields
}

func (*ProgramsResource) Approve

func (r *ProgramsResource) Approve(ctx context.Context, id, enrollmentID string) (JSON, error)

Short aliases (Node SDK v0.2.1 parity).

func (*ProgramsResource) ApproveEnrollment

func (r *ProgramsResource) ApproveEnrollment(ctx context.Context, id, enrollmentID string) (JSON, error)

func (*ProgramsResource) Commissions

func (r *ProgramsResource) Commissions(ctx context.Context, p CommissionsListParams) (JSON, error)

func (*ProgramsResource) Create

func (r *ProgramsResource) Create(ctx context.Context, input JSON) (JSON, error)

func (*ProgramsResource) Delete

func (r *ProgramsResource) Delete(ctx context.Context, id string) (*DeletedResult, error)

func (*ProgramsResource) Enrollments

func (r *ProgramsResource) Enrollments(ctx context.Context, id string) (JSON, error)

func (*ProgramsResource) Get

func (r *ProgramsResource) Get(ctx context.Context, id string) (JSON, error)

func (*ProgramsResource) List

func (r *ProgramsResource) List(ctx context.Context) (JSON, error)

func (*ProgramsResource) ListEnrollments

func (r *ProgramsResource) ListEnrollments(ctx context.Context, id string) (JSON, error)

func (*ProgramsResource) Reject

func (r *ProgramsResource) Reject(ctx context.Context, id, enrollmentID string) (JSON, error)

func (*ProgramsResource) RejectEnrollment

func (r *ProgramsResource) RejectEnrollment(ctx context.Context, id, enrollmentID string) (JSON, error)

func (*ProgramsResource) Revoke

func (r *ProgramsResource) Revoke(ctx context.Context, id, enrollmentID string) (JSON, error)

func (*ProgramsResource) RevokeEnrollment

func (r *ProgramsResource) RevokeEnrollment(ctx context.Context, id, enrollmentID string) (JSON, error)

func (*ProgramsResource) Update

func (r *ProgramsResource) Update(ctx context.Context, id string, patch JSON) (JSON, error)

type ProvisionWorkspaceInput

type ProvisionWorkspaceInput struct {
	AccountID     string  `json:"accountId"`
	Partner       string  `json:"partner"` // "storlaunch"
	DiscountRate  float64 `json:"discountRate"`
	BrandName     *string `json:"brandName,omitempty"`
	BusinessEmail *string `json:"businessEmail,omitempty"`
}

type PublicApplicableCode

type PublicApplicableCode struct {
	Code              string        `json:"code"`
	Description       *string       `json:"description"`
	Type              DiscountType  `json:"type"`
	Value             float64       `json:"value"`
	Scope             DiscountScope `json:"scope"`
	MinPurchaseAmount *float64      `json:"minPurchaseAmount"`
	ExpiresAt         *string       `json:"expiresAt"`
	EstimatedDiscount float64       `json:"estimatedDiscount"`
	Eligible          bool          `json:"eligible"`
}

type PublicPixels

type PublicPixels struct {
	MetaPixelID            *string `json:"metaPixelId"`
	GoogleAnalyticsID      *string `json:"googleAnalyticsId"`
	GoogleAdsConversionID  *string `json:"googleAdsConversionId"`
	GoogleAdsPurchaseLabel *string `json:"googleAdsPurchaseLabel"`
	TiktokPixelID          *string `json:"tiktokPixelId"`
	Enabled                bool    `json:"enabled"`
}

type RecordClickInput

type RecordClickInput struct {
	AccountID string `json:"accountId"`
	Code      string `json:"code"`
}

type RecordClickResult

type RecordClickResult struct {
	LinkID    string `json:"linkId"`
	ProgramID string `json:"programId"`
}

type RecordReminderInput

type RecordReminderInput struct {
	AccountID      string  `json:"accountId"`
	CustomerID     string  `json:"customerId"`
	CartID         string  `json:"cartId"`
	Email          string  `json:"email"`
	CartSnapshot   any     `json:"cartSnapshot"`
	ValueAtSend    float64 `json:"valueAtSend"`
	CurrencyAtSend string  `json:"currencyAtSend"`
	DiscountCodeID *string `json:"discountCodeId,omitempty"`
	ExternalSource *string `json:"externalSource,omitempty"`
	ExternalRef    *string `json:"externalRef,omitempty"`
}

type RecordReminderResult

type RecordReminderResult struct {
	ID      string `json:"id"`
	Created bool   `json:"created"`
	Reason  string `json:"reason,omitempty"`
}

type RecoveryStats

type RecoveryStats struct {
	RemindersSent        int     `json:"remindersSent"`
	CartsRecovered       int     `json:"cartsRecovered"`
	RecoveryRate         float64 `json:"recoveryRate"`
	RecoveredValueAtSend float64 `json:"recoveredValueAtSend"`
	Currency             *string `json:"currency"`
}

type RedeemInput

type RedeemInput struct {
	AccountID         string   `json:"accountId"`
	DiscountCodeID    string   `json:"discountCodeId"`
	CheckoutSessionID string   `json:"checkoutSessionId"`
	CustomerID        *string  `json:"customerId,omitempty"`
	AppliedAmount     float64  `json:"appliedAmount"`
	AppliedShipping   *float64 `json:"appliedShipping,omitempty"`
	ExternalSource    *string  `json:"externalSource,omitempty"`
	ExternalRef       *string  `json:"externalRef,omitempty"`
}

type RedeemResult

type RedeemResult struct {
	ID      string `json:"id"`
	Created bool   `json:"created"`
}

type ReferralAttribution

type ReferralAttribution struct {
	ID                          string                    `json:"id"`
	ProgramID                   string                    `json:"programId"`
	AccountID                   string                    `json:"accountId"`
	LinkID                      string                    `json:"linkId"`
	ReferrerCustomerID          string                    `json:"referrerCustomerId"`
	RefereeCustomerID           string                    `json:"refereeCustomerId"`
	Status                      ReferralAttributionStatus `json:"status"`
	ReferrerRewardCodeID        *string                   `json:"referrerRewardCodeId"`
	RefereeRewardCodeID         *string                   `json:"refereeRewardCodeId"`
	QualifyingCheckoutSessionID *string                   `json:"qualifyingCheckoutSessionId"`
	ExpiresAt                   string                    `json:"expiresAt"`
	ExternalSource              *string                   `json:"externalSource"`
	ExternalRef                 *string                   `json:"externalRef"`
	ClickedAt                   string                    `json:"clickedAt"`
	SignedUpAt                  *string                   `json:"signedUpAt"`
	RewardedAt                  *string                   `json:"rewardedAt"`
	VoidedAt                    *string                   `json:"voidedAt"`
	VoidReason                  *string                   `json:"voidReason"`
	CreatedAt                   string                    `json:"createdAt"`
}

type ReferralAttributionStatus

type ReferralAttributionStatus string

ReferralAttributionStatus — `pending` | `rewarded` | `voided` | `expired`.

type ReferralLink struct {
	ID         string  `json:"id"`
	ProgramID  string  `json:"programId"`
	AccountID  string  `json:"accountId"`
	CustomerID string  `json:"customerId"`
	Code       string  `json:"code"`
	Clicks     int     `json:"clicks"`
	Signups    int     `json:"signups"`
	Rewards    int     `json:"rewards"`
	Revenue    float64 `json:"revenue"`
	CreatedAt  string  `json:"createdAt"`
}

type ReferralProgram

type ReferralProgram struct {
	ID                    string       `json:"id"`
	AccountID             string       `json:"accountId"`
	Enabled               bool         `json:"enabled"`
	RewardType            DiscountType `json:"rewardType"`
	ReferrerValue         float64      `json:"referrerValue"`
	RefereeValue          float64      `json:"refereeValue"`
	Currency              string       `json:"currency"`
	MinPurchaseAmount     *float64     `json:"minPurchaseAmount"`
	RewardExpiryDays      int          `json:"rewardExpiryDays"`
	AttributionWindowDays int          `json:"attributionWindowDays"`
	MaxRewardsPerReferrer *int         `json:"maxRewardsPerReferrer"`
	ProgramTerms          *string      `json:"programTerms"`
	CreatedAt             string       `json:"createdAt"`
	UpdatedAt             string       `json:"updatedAt"`
}

type ReferralProgramInput

type ReferralProgramInput struct {
	Enabled               *bool        `json:"enabled,omitempty"`
	RewardType            DiscountType `json:"rewardType"`
	ReferrerValue         float64      `json:"referrerValue"`
	RefereeValue          float64      `json:"refereeValue"`
	Currency              string       `json:"currency"`
	MinPurchaseAmount     *float64     `json:"minPurchaseAmount,omitempty"`
	RewardExpiryDays      *int         `json:"rewardExpiryDays,omitempty"`
	AttributionWindowDays *int         `json:"attributionWindowDays,omitempty"`
	MaxRewardsPerReferrer *int         `json:"maxRewardsPerReferrer,omitempty"`
	ProgramTerms          *string      `json:"programTerms,omitempty"`
}

type ReferralsResource

type ReferralsResource struct {
	// contains filtered or unexported fields
}

func (*ReferralsResource) AttributeCheckoutStart

func (*ReferralsResource) AttributeOnSignup

func (*ReferralsResource) ExpirePending

func (r *ReferralsResource) ExpirePending(ctx context.Context) (*ExpirePendingResult, error)

func (*ReferralsResource) FulfillRewardOnPayment

func (r *ReferralsResource) FulfillRewardOnPayment(ctx context.Context, input FulfillRewardInput) (*FulfillRewardResult, error)

func (*ReferralsResource) GetProgram

func (r *ReferralsResource) GetProgram(ctx context.Context) (*ReferralProgram, error)

func (*ReferralsResource) ListMyRewards

func (r *ReferralsResource) ListMyRewards(ctx context.Context, accountID, customerID string) (*MyRewardsListWrap, error)

func (*ReferralsResource) PutProgram

func (*ReferralsResource) RecordClick

func (r *ReferralsResource) ResolveLink(ctx context.Context, accountID, code string) (*ResolveLinkResult, error)

func (*ReferralsResource) Stats

func (*ReferralsResource) VoidAttributionOnRefund

func (r *ReferralsResource) VoidAttributionOnRefund(ctx context.Context, checkoutSessionID string) (*VoidAttributionResult, error)

type RemindersListParams

type RemindersListParams struct {
	Limit *int
}

type RemindersListWrap

type RemindersListWrap struct {
	Items []AbandonedCartReminder `json:"items"`
}

type RequestOptions

type RequestOptions struct {
	Method         string // GET / POST / PATCH / PUT / DELETE
	Path           string // full URL path including any querystring (e.g. "/api/v1/x?limit=5")
	Body           any    // optional; JSON-encoded if non-nil
	IdempotencyKey string // optional
	OnBehalfOf     string // overrides Client.defaultOnBehalfOf
}

RequestOptions configures a single Do call.

type ResolveLinkResult

type ResolveLinkResult struct {
	Link ReferralLink `json:"link"`
}

type RevokedResult

type RevokedResult struct {
	Revoked bool `json:"revoked"`
}

type SignInput

type SignInput struct {
	Filename    string `json:"filename"`
	ContentType string `json:"contentType"`
	Bytes       *int   `json:"bytes,omitempty"`
}

type SignResult

type SignResult struct {
	URL     string            `json:"url"`
	Key     string            `json:"key"`
	Headers map[string]string `json:"headers,omitempty"`
}

type StatsParams

type StatsParams struct {
	WindowDays *int
}

type UploadsResource

type UploadsResource struct {
	// contains filtered or unexported fields
}

func (*UploadsResource) GetAvatar

func (r *UploadsResource) GetAvatar(ctx context.Context, key *string) (JSON, error)

func (*UploadsResource) GetDeliverable

func (r *UploadsResource) GetDeliverable(ctx context.Context, key string) (JSON, error)

func (*UploadsResource) GetMerchantAsset

func (r *UploadsResource) GetMerchantAsset(ctx context.Context, key string) (JSON, error)

func (*UploadsResource) Sign

func (r *UploadsResource) Sign(ctx context.Context, input SignInput) (*SignResult, error)

func (*UploadsResource) SignMerchant

func (r *UploadsResource) SignMerchant(ctx context.Context, input SignInput) (*SignResult, error)

type ValidateInput

type ValidateInput struct {
	AccountID    string             `json:"accountId"`
	Code         string             `json:"code"`
	Subtotal     float64            `json:"subtotal"`
	Currency     string             `json:"currency"`
	ShippingCost *float64           `json:"shippingCost,omitempty"`
	CustomerID   *string            `json:"customerId,omitempty"`
	Items        []ValidateLineItem `json:"items,omitempty"`
}

type ValidateLineItem

type ValidateLineItem struct {
	ProductID *string  `json:"productId,omitempty"`
	Price     float64  `json:"price"`
	Quantity  int      `json:"quantity"`
	Tags      []string `json:"tags,omitempty"`
}

type ValidateResult

type ValidateResult struct {
	Valid            bool          `json:"valid"`
	Code             *DiscountCode `json:"code,omitempty"`
	Reason           string        `json:"reason,omitempty"`
	DiscountAmount   float64       `json:"discountAmount"`
	DiscountShipping float64       `json:"discountShipping"`
}

type VerifyWebhookOptions

type VerifyWebhookOptions struct {
	// ToleranceSeconds rejects signatures with a timestamp older than this
	// many seconds. Zero or negative means "use the default" (300).
	ToleranceSeconds int64
	// Now is the clock used for the freshness check. Nil means time.Now.
	// Useful in tests.
	Now func() time.Time
}

VerifyWebhookOptions tunes the webhook verifier. Pass nil to use the defaults (300 s tolerance, time.Now clock).

type VoidAttributionResult

type VoidAttributionResult struct {
	Voided     bool `json:"voided"`
	ClawedBack bool `json:"clawedBack"`
}

type WebhookEndpointInput

type WebhookEndpointInput struct {
	URL         string   `json:"url"`
	Events      []string `json:"events,omitempty"`
	Description *string  `json:"description,omitempty"`
}

type WebhookEvent

type WebhookEvent struct {
	ID         string          `json:"id"`
	Type       string          `json:"type"`
	OccurredAt string          `json:"occurredAt"`
	AccountID  *string         `json:"accountId"`
	Data       json.RawMessage `json:"data"`
	Metadata   map[string]any  `json:"metadata"`
}

WebhookEvent is the parsed envelope returned by VerifyWebhook. Data is left as raw JSON so callers can decode into a concrete type.

func VerifyWebhook

func VerifyWebhook(rawBody []byte, signatureHeader, secret string, opts *VerifyWebhookOptions) (*WebhookEvent, error)

VerifyWebhook verifies an inbound Ripllo webhook signature and returns the parsed event envelope.

Header: `Ripllo-Signature: t=<unix>,v1=<hex>` Signed payload: `${t}.${rawBody}` with HMAC-SHA256 keyed on the endpoint's shared secret.

IMPORTANT: pass the raw bytes you received over the wire. If you let a framework parse JSON first and re-stringify, whitespace drift will break the signature.

Mirrors Node `verifyWebhook` + Python `verify_webhook`.

type WebhooksResource

type WebhooksResource struct {
	// contains filtered or unexported fields
}

func (*WebhooksResource) CreateEndpoint

func (r *WebhooksResource) CreateEndpoint(ctx context.Context, input WebhookEndpointInput) (JSON, error)

func (*WebhooksResource) DeleteEndpoint

func (r *WebhooksResource) DeleteEndpoint(ctx context.Context, id string) (*DeletedResult, error)

func (*WebhooksResource) ListEndpoints

func (r *WebhooksResource) ListEndpoints(ctx context.Context) (JSON, error)

func (*WebhooksResource) ListEvents

func (r *WebhooksResource) ListEvents(ctx context.Context, p EventsListParams) (JSON, error)

func (*WebhooksResource) UpdateEndpoint

func (r *WebhooksResource) UpdateEndpoint(ctx context.Context, id string, patch JSON) (JSON, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL